@cparra/apex-reflection 2.9.1 → 2.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,6 +122,22 @@ describe('Interface Reflection', () => {
122
122
  expect(result.annotations.length).toBe(1);
123
123
  expect(result.annotations[0].name).toBe('namespaceaccessible');
124
124
  });
125
+
126
+ test('Methods can have their own annotations', () => {
127
+ const interfaceBody = `
128
+ @NamespaceAccessible
129
+ public with sharing interface MyInterface{
130
+ @Deprecated
131
+ void method1();
132
+ }
133
+ `;
134
+ const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
135
+ expect(result.methods[0].annotations.length).toBe(2);
136
+
137
+ const annotationNames = result.methods[0].annotations.map(a => a.name);
138
+ expect(annotationNames).toContain('namespaceaccessible');
139
+ expect(annotationNames).toContain('deprecated');
140
+ });
125
141
  });
126
142
 
127
143
  describe('Class reflection', () => {
package/index.d.ts CHANGED
@@ -39,7 +39,7 @@ export interface Annotation {
39
39
  type: string;
40
40
  elementValues?: AnnotationElementValue[];
41
41
  }
42
- export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType;
42
+ export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType | GenericObjectType;
43
43
  export interface ReferenceObjectType {
44
44
  type: string;
45
45
  rawDeclaration: string;
@@ -54,6 +54,9 @@ export interface MapObjectType extends ReferenceObjectType {
54
54
  keyType: ReferenceObjectType;
55
55
  valueType: ReferenceObjectType;
56
56
  }
57
+ export interface GenericObjectType extends ReferenceObjectType {
58
+ ofType: ReferenceObjectType;
59
+ }
57
60
  export interface EnumValue {
58
61
  name: string;
59
62
  docComment?: DocComment;
package/index.ts CHANGED
@@ -52,7 +52,7 @@ export interface Annotation {
52
52
  elementValues?: AnnotationElementValue[];
53
53
  }
54
54
 
55
- export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType;
55
+ export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType | GenericObjectType;
56
56
 
57
57
  export interface ReferenceObjectType {
58
58
  type: string;
@@ -72,6 +72,10 @@ export interface MapObjectType extends ReferenceObjectType {
72
72
  valueType: ReferenceObjectType;
73
73
  }
74
74
 
75
+ export interface GenericObjectType extends ReferenceObjectType {
76
+ ofType: ReferenceObjectType;
77
+ }
78
+
75
79
  export interface EnumValue {
76
80
  name: string;
77
81
  docComment?: DocComment;