@cparra/apex-reflection 0.1.0-alpha.0 → 0.1.1-alpha.10

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.
Files changed (158) hide show
  1. package/__tests__/end-to-end.test.ts +256 -0
  2. package/coverage/clover.xml +12857 -0
  3. package/coverage/coverage-final.json +3 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +79 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +126 -0
  8. package/coverage/lcov-report/index.js.html +104 -0
  9. package/coverage/lcov-report/out.js.html +41126 -0
  10. package/coverage/lcov-report/prettify.css +1 -0
  11. package/coverage/lcov-report/prettify.js +2 -0
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/sorter.js +170 -0
  14. package/coverage/lcov.info +24801 -0
  15. package/index.d.ts +118 -0
  16. package/index.js +8 -0
  17. package/index.ts +141 -0
  18. package/jest.config.js +11 -0
  19. package/out.js +13708 -0
  20. package/package.json +22 -17
  21. package/tsconfig.json +5 -3
  22. package/.idea/apexdocs-dart.iml +0 -18
  23. package/.idea/jsLibraryMappings.xml +0 -6
  24. package/.idea/libraries/Dart_Packages.xml +0 -556
  25. package/.idea/libraries/Dart_SDK.xml +0 -28
  26. package/.idea/misc.xml +0 -6
  27. package/.idea/modules.xml +0 -8
  28. package/.idea/runConfigurations/_template__of_Dart_Test.xml +0 -6
  29. package/.idea/vcs.xml +0 -6
  30. package/CHANGELOG.md +0 -3
  31. package/README.md +0 -26
  32. package/TODO.md +0 -5
  33. package/analysis_options.yaml +0 -30
  34. package/antlr4-4.9.2/CHANGELOG.md +0 -4
  35. package/antlr4-4.9.2/LICENSE +0 -52
  36. package/antlr4-4.9.2/README.md +0 -11
  37. package/antlr4-4.9.2/analysis_options.yaml +0 -1
  38. package/antlr4-4.9.2/lib/antlr4.dart +0 -21
  39. package/antlr4-4.9.2/lib/src/atn/atn.dart +0 -18
  40. package/antlr4-4.9.2/lib/src/atn/src/atn.dart +0 -170
  41. package/antlr4-4.9.2/lib/src/atn/src/atn_config.dart +0 -242
  42. package/antlr4-4.9.2/lib/src/atn/src/atn_config_set.dart +0 -283
  43. package/antlr4-4.9.2/lib/src/atn/src/atn_deserializer.dart +0 -809
  44. package/antlr4-4.9.2/lib/src/atn/src/atn_simulator.dart +0 -95
  45. package/antlr4-4.9.2/lib/src/atn/src/atn_state.dart +0 -296
  46. package/antlr4-4.9.2/lib/src/atn/src/atn_type.dart +0 -14
  47. package/antlr4-4.9.2/lib/src/atn/src/info.dart +0 -553
  48. package/antlr4-4.9.2/lib/src/atn/src/lexer_action.dart +0 -601
  49. package/antlr4-4.9.2/lib/src/atn/src/lexer_action_executor.dart +0 -167
  50. package/antlr4-4.9.2/lib/src/atn/src/lexer_atn_simulator.dart +0 -731
  51. package/antlr4-4.9.2/lib/src/atn/src/parser_atn_simulator.dart +0 -2630
  52. package/antlr4-4.9.2/lib/src/atn/src/profiling_atn_simulator.dart +0 -229
  53. package/antlr4-4.9.2/lib/src/atn/src/semantic_context.dart +0 -404
  54. package/antlr4-4.9.2/lib/src/atn/src/transition.dart +0 -305
  55. package/antlr4-4.9.2/lib/src/dfa/dfa.dart +0 -8
  56. package/antlr4-4.9.2/lib/src/dfa/src/dfa.dart +0 -138
  57. package/antlr4-4.9.2/lib/src/dfa/src/dfa_serializer.dart +0 -76
  58. package/antlr4-4.9.2/lib/src/dfa/src/dfa_state.dart +0 -151
  59. package/antlr4-4.9.2/lib/src/error/error.dart +0 -10
  60. package/antlr4-4.9.2/lib/src/error/src/diagnostic_error_listener.dart +0 -116
  61. package/antlr4-4.9.2/lib/src/error/src/error_listener.dart +0 -241
  62. package/antlr4-4.9.2/lib/src/error/src/error_strategy.dart +0 -902
  63. package/antlr4-4.9.2/lib/src/error/src/errors.dart +0 -204
  64. package/antlr4-4.9.2/lib/src/input_stream.dart +0 -335
  65. package/antlr4-4.9.2/lib/src/interval_set.dart +0 -735
  66. package/antlr4-4.9.2/lib/src/lexer.dart +0 -343
  67. package/antlr4-4.9.2/lib/src/ll1_analyzer.dart +0 -204
  68. package/antlr4-4.9.2/lib/src/misc/multi_map.dart +0 -32
  69. package/antlr4-4.9.2/lib/src/misc/pair.dart +0 -34
  70. package/antlr4-4.9.2/lib/src/parser.dart +0 -777
  71. package/antlr4-4.9.2/lib/src/parser_interpreter.dart +0 -393
  72. package/antlr4-4.9.2/lib/src/parser_rule_context.dart +0 -275
  73. package/antlr4-4.9.2/lib/src/prediction_context.dart +0 -877
  74. package/antlr4-4.9.2/lib/src/recognizer.dart +0 -182
  75. package/antlr4-4.9.2/lib/src/rule_context.dart +0 -192
  76. package/antlr4-4.9.2/lib/src/runtime_meta_data.dart +0 -188
  77. package/antlr4-4.9.2/lib/src/token.dart +0 -431
  78. package/antlr4-4.9.2/lib/src/token_factory.dart +0 -88
  79. package/antlr4-4.9.2/lib/src/token_source.dart +0 -241
  80. package/antlr4-4.9.2/lib/src/token_stream.dart +0 -627
  81. package/antlr4-4.9.2/lib/src/tree/src/pattern/chunk.dart +0 -90
  82. package/antlr4-4.9.2/lib/src/tree/src/pattern/parse_tree_match.dart +0 -635
  83. package/antlr4-4.9.2/lib/src/tree/src/tree.dart +0 -370
  84. package/antlr4-4.9.2/lib/src/tree/src/trees.dart +0 -226
  85. package/antlr4-4.9.2/lib/src/tree/tree.dart +0 -10
  86. package/antlr4-4.9.2/lib/src/util/bit_set.dart +0 -308
  87. package/antlr4-4.9.2/lib/src/util/murmur_hash.dart +0 -77
  88. package/antlr4-4.9.2/lib/src/util/utils.dart +0 -31
  89. package/antlr4-4.9.2/lib/src/vocabulary.dart +0 -254
  90. package/antlr4-4.9.2/pubspec.yaml +0 -13
  91. package/example/node_example/index.js +0 -8
  92. package/example/node_example/package.json +0 -12
  93. package/example/node_example_ts/package-lock.json +0 -70
  94. package/example/node_example_ts/package.json +0 -19
  95. package/example/node_example_ts/src/index.js +0 -5
  96. package/example/node_example_ts/src/index.ts +0 -9
  97. package/example/node_example_ts/tsconfig.json +0 -79
  98. package/js/dart2jsout.js +0 -25898
  99. package/js/dart2jsout.js.map +0 -16
  100. package/js/index.d.ts +0 -1
  101. package/js/index.js +0 -4
  102. package/js/out.js +0 -26023
  103. package/js/out.js.map +0 -16
  104. package/js/package-lock.json +0 -57
  105. package/js/preamble.js +0 -125
  106. package/lib/apexdocs_dart.dart +0 -28
  107. package/lib/src/antlr/grammars/Apexdoc/ApexdocLexer.g4 +0 -120
  108. package/lib/src/antlr/grammars/Apexdoc/ApexdocParser.g4 +0 -158
  109. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.interp +0 -95
  110. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.java +0 -238
  111. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.tokens +0 -23
  112. package/lib/src/antlr/grammars/apex/ApexLexer.g4 +0 -255
  113. package/lib/src/antlr/grammars/apex/ApexParser.g4 +0 -567
  114. package/lib/src/antlr/grammars/apex/examples/ApexClass.cls +0 -6
  115. package/lib/src/antlr/lib/apex/ApexLexer.dart +0 -1223
  116. package/lib/src/antlr/lib/apex/ApexLexer.interp +0 -393
  117. package/lib/src/antlr/lib/apex/ApexLexer.tokens +0 -212
  118. package/lib/src/antlr/lib/apex/ApexParser.dart +0 -9349
  119. package/lib/src/antlr/lib/apex/ApexParser.interp +0 -326
  120. package/lib/src/antlr/lib/apex/ApexParser.tokens +0 -212
  121. package/lib/src/antlr/lib/apex/ApexParserBaseListener.dart +0 -1036
  122. package/lib/src/antlr/lib/apex/ApexParserListener.dart +0 -975
  123. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.dart +0 -373
  124. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.interp +0 -95
  125. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.tokens +0 -23
  126. package/lib/src/antlr/lib/apexdoc/ApexdocParser.dart +0 -2471
  127. package/lib/src/antlr/lib/apexdoc/ApexdocParser.interp +0 -69
  128. package/lib/src/antlr/lib/apexdoc/ApexdocParser.tokens +0 -23
  129. package/lib/src/antlr/lib/apexdoc/ApexdocParserBaseListener.dart +0 -252
  130. package/lib/src/antlr/lib/apexdoc/ApexdocParserListener.dart +0 -215
  131. package/lib/src/builders/builders.dart +0 -32
  132. package/lib/src/model/apex_file_manifest.dart +0 -37
  133. package/lib/src/model/apex_file_manifest.g.dart +0 -18
  134. package/lib/src/model/declaration.dart +0 -50
  135. package/lib/src/model/doc_comment.dart +0 -117
  136. package/lib/src/model/doc_comment.g.dart +0 -118
  137. package/lib/src/model/members.dart +0 -143
  138. package/lib/src/model/members.g.dart +0 -105
  139. package/lib/src/model/types.dart +0 -159
  140. package/lib/src/model/types.g.dart +0 -111
  141. package/lib/src/service/apex_listener.dart +0 -226
  142. package/lib/src/service/apexdoc_listener.dart +0 -82
  143. package/lib/src/service/parsers.dart +0 -33
  144. package/lib/src/service/utils/parsing/access_modifiers_parser.dart +0 -33
  145. package/lib/src/service/utils/parsing/parameters_parser.dart +0 -18
  146. package/lib/src/service/utils/parsing/parsing_utils.dart +0 -2
  147. package/lib/src/service/walker.dart +0 -82
  148. package/pubspec.yaml +0 -19
  149. package/test/apex_file_manifest_test.dart +0 -16
  150. package/test/apex_listener_test.dart +0 -703
  151. package/test/apexdoc_parser_test.dart +0 -179
  152. package/test/doc_comment_test.dart +0 -89
  153. package/test/members_serialization_test.dart +0 -158
  154. package/test/members_test.dart +0 -178
  155. package/test/types_serialization_test.dart +0 -191
  156. package/test/types_test.dart +0 -311
  157. package/test/walker_test.dart +0 -58
  158. package/tool/grind.dart +0 -20
@@ -1,50 +0,0 @@
1
- import 'package:apexdocs_dart/src/model/doc_comment.dart';
2
- import 'package:apexdocs_dart/src/service/parsers.dart';
3
- import 'package:json_annotation/json_annotation.dart';
4
-
5
- mixin AccessModifierAwareness {
6
- @JsonKey(name: 'access_modifiers')
7
- List<String> accessModifiers = [];
8
-
9
- get isPrivate => accessModifiers.contains('private');
10
-
11
- get isPublic => accessModifiers.contains('public');
12
-
13
- get isGlobal => accessModifiers.contains('global');
14
-
15
- get isProtected => accessModifiers.contains('protected');
16
-
17
- get isVirtual => accessModifiers.contains('virtual');
18
-
19
- get isNamespaceAccessible => accessModifiers.contains('namespaceaccessible');
20
-
21
- get isTest => accessModifiers.contains('istest');
22
-
23
- get isDeprecated => accessModifiers.contains('deprecated');
24
- }
25
-
26
- mixin DocsCommentAwareness {
27
- DocComment? _docComment;
28
- String? rawDocComment;
29
-
30
- DocComment? get docComment => _docComment ??= _parseDocComment();
31
-
32
- DocComment? _parseDocComment() {
33
- if (rawDocComment == null) {
34
- return null;
35
- }
36
- _docComment = ApexdocParser.parseFromBody(rawDocComment!);
37
- return _docComment;
38
- }
39
-
40
- String? get docDescription => docComment?.description;
41
- }
42
-
43
- abstract class Declaration with AccessModifierAwareness, DocsCommentAwareness {
44
- final String name;
45
-
46
- Declaration({required this.name, docComment, accessModifiers}) {
47
- this.accessModifiers = accessModifiers;
48
- rawDocComment = docComment;
49
- }
50
- }
@@ -1,117 +0,0 @@
1
- import 'package:json_annotation/json_annotation.dart';
2
-
3
- part 'doc_comment.g.dart';
4
-
5
- @JsonSerializable()
6
- class DocComment {
7
- late List<String> _descriptionLines;
8
- List<ParamDocCommentAnnotation> paramAnnotations = [];
9
- ReturnDocCommentAnnotation? returnAnnotation;
10
- ExampleDocCommentAnnotation? exampleAnnotation;
11
- List<ThrowsDocCommentAnnotation> throwsAnnotations = [];
12
- List<DocCommentAnnotation> annotations = [];
13
-
14
- DocComment(String description) {
15
- _descriptionLines = [if (description.isNotEmpty) description];
16
- }
17
-
18
- DocComment.withLines(List<String> descriptionLines) {
19
- _descriptionLines = descriptionLines;
20
- }
21
-
22
- factory DocComment.fromJson(Map<String, dynamic> json) =>
23
- _$DocCommentFromJson(json);
24
-
25
- Map<String, dynamic> toJson() => _$DocCommentToJson(this);
26
-
27
- List<String> get descriptionLines => _descriptionLines.isNotEmpty
28
- ? _descriptionLines
29
- : annotations
30
- .firstWhere((element) => element.name == 'description')
31
- .bodyLines;
32
-
33
- set descriptionLines(List<String> descriptionLines) {
34
- _descriptionLines = descriptionLines;
35
- }
36
-
37
- /// Gets the description as a single line.
38
- String get description => descriptionLines.join(' ');
39
-
40
- List<DocCommentAnnotation> annotationsByName(String annotationName) {
41
- return annotations
42
- .where((element) => element.name == annotationName)
43
- .toList();
44
- }
45
- }
46
-
47
- @JsonSerializable()
48
- class DocCommentAnnotation {
49
- final String name;
50
-
51
- List<String> bodyLines = [];
52
-
53
- String get body => bodyLines.join(' ');
54
-
55
- DocCommentAnnotation(this.name, body) {
56
- if (body is String) {
57
- bodyLines = [body];
58
- return;
59
- }
60
- bodyLines = body;
61
- }
62
-
63
- factory DocCommentAnnotation.fromJson(Map<String, dynamic> json) =>
64
- _$DocCommentAnnotationFromJson(json);
65
-
66
- Map<String, dynamic> toJson() => _$DocCommentAnnotationToJson(this);
67
- }
68
-
69
- @JsonSerializable()
70
- class ParamDocCommentAnnotation extends DocCommentAnnotation {
71
- final String paramName;
72
-
73
- ParamDocCommentAnnotation(this.paramName, bodyLines)
74
- : super('param', bodyLines);
75
-
76
- factory ParamDocCommentAnnotation.fromJson(Map<String, dynamic> json) =>
77
- _$ParamDocCommentAnnotationFromJson(json);
78
-
79
- @override
80
- Map<String, dynamic> toJson() => _$ParamDocCommentAnnotationToJson(this);
81
- }
82
-
83
- @JsonSerializable()
84
- class ReturnDocCommentAnnotation extends DocCommentAnnotation {
85
- ReturnDocCommentAnnotation(bodyLines) : super('return', bodyLines);
86
-
87
- factory ReturnDocCommentAnnotation.fromJson(Map<String, dynamic> json) =>
88
- _$ReturnDocCommentAnnotationFromJson(json);
89
-
90
- @override
91
- Map<String, dynamic> toJson() => _$ReturnDocCommentAnnotationToJson(this);
92
- }
93
-
94
- @JsonSerializable()
95
- class ThrowsDocCommentAnnotation extends DocCommentAnnotation {
96
- final String exceptionName;
97
-
98
- ThrowsDocCommentAnnotation(this.exceptionName, bodyLines)
99
- : super('throws', bodyLines);
100
-
101
- factory ThrowsDocCommentAnnotation.fromJson(Map<String, dynamic> json) =>
102
- _$ThrowsDocCommentAnnotationFromJson(json);
103
-
104
- @override
105
- Map<String, dynamic> toJson() => _$ThrowsDocCommentAnnotationToJson(this);
106
- }
107
-
108
- @JsonSerializable()
109
- class ExampleDocCommentAnnotation extends DocCommentAnnotation {
110
- ExampleDocCommentAnnotation(bodyLines) : super('example', bodyLines);
111
-
112
- factory ExampleDocCommentAnnotation.fromJson(Map<String, dynamic> json) =>
113
- _$ExampleDocCommentAnnotationFromJson(json);
114
-
115
- @override
116
- Map<String, dynamic> toJson() => _$ExampleDocCommentAnnotationToJson(this);
117
- }
@@ -1,118 +0,0 @@
1
- // GENERATED CODE - DO NOT MODIFY BY HAND
2
-
3
- part of 'doc_comment.dart';
4
-
5
- // **************************************************************************
6
- // JsonSerializableGenerator
7
- // **************************************************************************
8
-
9
- DocComment _$DocCommentFromJson(Map<String, dynamic> json) {
10
- return DocComment(
11
- json['description'] as String,
12
- )
13
- ..paramAnnotations = (json['paramAnnotations'] as List<dynamic>)
14
- .map((e) =>
15
- ParamDocCommentAnnotation.fromJson(e as Map<String, dynamic>))
16
- .toList()
17
- ..returnAnnotation = json['returnAnnotation'] == null
18
- ? null
19
- : ReturnDocCommentAnnotation.fromJson(
20
- json['returnAnnotation'] as Map<String, dynamic>)
21
- ..exampleAnnotation = json['exampleAnnotation'] == null
22
- ? null
23
- : ExampleDocCommentAnnotation.fromJson(
24
- json['exampleAnnotation'] as Map<String, dynamic>)
25
- ..throwsAnnotations = (json['throwsAnnotations'] as List<dynamic>)
26
- .map((e) =>
27
- ThrowsDocCommentAnnotation.fromJson(e as Map<String, dynamic>))
28
- .toList()
29
- ..annotations = (json['annotations'] as List<dynamic>)
30
- .map((e) => DocCommentAnnotation.fromJson(e as Map<String, dynamic>))
31
- .toList()
32
- ..descriptionLines = (json['descriptionLines'] as List<dynamic>)
33
- .map((e) => e as String)
34
- .toList();
35
- }
36
-
37
- Map<String, dynamic> _$DocCommentToJson(DocComment instance) =>
38
- <String, dynamic>{
39
- 'paramAnnotations': instance.paramAnnotations,
40
- 'returnAnnotation': instance.returnAnnotation,
41
- 'exampleAnnotation': instance.exampleAnnotation,
42
- 'throwsAnnotations': instance.throwsAnnotations,
43
- 'annotations': instance.annotations,
44
- 'descriptionLines': instance.descriptionLines,
45
- 'description': instance.description,
46
- };
47
-
48
- DocCommentAnnotation _$DocCommentAnnotationFromJson(Map<String, dynamic> json) {
49
- return DocCommentAnnotation(
50
- json['name'] as String,
51
- json['body'],
52
- )..bodyLines =
53
- (json['bodyLines'] as List<dynamic>).map((e) => e as String).toList();
54
- }
55
-
56
- Map<String, dynamic> _$DocCommentAnnotationToJson(
57
- DocCommentAnnotation instance) =>
58
- <String, dynamic>{
59
- 'name': instance.name,
60
- 'bodyLines': instance.bodyLines,
61
- 'body': instance.body,
62
- };
63
-
64
- ParamDocCommentAnnotation _$ParamDocCommentAnnotationFromJson(
65
- Map<String, dynamic> json) {
66
- return ParamDocCommentAnnotation(
67
- json['paramName'] as String,
68
- json['bodyLines'],
69
- );
70
- }
71
-
72
- Map<String, dynamic> _$ParamDocCommentAnnotationToJson(
73
- ParamDocCommentAnnotation instance) =>
74
- <String, dynamic>{
75
- 'bodyLines': instance.bodyLines,
76
- 'paramName': instance.paramName,
77
- };
78
-
79
- ReturnDocCommentAnnotation _$ReturnDocCommentAnnotationFromJson(
80
- Map<String, dynamic> json) {
81
- return ReturnDocCommentAnnotation(
82
- json['bodyLines'],
83
- );
84
- }
85
-
86
- Map<String, dynamic> _$ReturnDocCommentAnnotationToJson(
87
- ReturnDocCommentAnnotation instance) =>
88
- <String, dynamic>{
89
- 'bodyLines': instance.bodyLines,
90
- };
91
-
92
- ThrowsDocCommentAnnotation _$ThrowsDocCommentAnnotationFromJson(
93
- Map<String, dynamic> json) {
94
- return ThrowsDocCommentAnnotation(
95
- json['exceptionName'] as String,
96
- json['bodyLines'],
97
- );
98
- }
99
-
100
- Map<String, dynamic> _$ThrowsDocCommentAnnotationToJson(
101
- ThrowsDocCommentAnnotation instance) =>
102
- <String, dynamic>{
103
- 'bodyLines': instance.bodyLines,
104
- 'exceptionName': instance.exceptionName,
105
- };
106
-
107
- ExampleDocCommentAnnotation _$ExampleDocCommentAnnotationFromJson(
108
- Map<String, dynamic> json) {
109
- return ExampleDocCommentAnnotation(
110
- json['bodyLines'],
111
- );
112
- }
113
-
114
- Map<String, dynamic> _$ExampleDocCommentAnnotationToJson(
115
- ExampleDocCommentAnnotation instance) =>
116
- <String, dynamic>{
117
- 'bodyLines': instance.bodyLines,
118
- };
@@ -1,143 +0,0 @@
1
- import 'package:apexdocs_dart/src/model/declaration.dart';
2
- import 'package:json_annotation/json_annotation.dart';
3
-
4
- part 'members.g.dart';
5
-
6
- abstract class TypedDeclaration extends Declaration {
7
- final String type;
8
-
9
- TypedDeclaration(
10
- {required String name,
11
- String? docComment,
12
- required this.type,
13
- List<String> accessModifiers = const []})
14
- : super(
15
- name: name,
16
- docComment: docComment,
17
- accessModifiers: accessModifiers);
18
- }
19
-
20
- @JsonSerializable()
21
- class Property extends TypedDeclaration {
22
- Property(
23
- {required String name,
24
- String? docComment,
25
- required String type,
26
- List<String> accessModifiers = const []})
27
- : super(
28
- name: name,
29
- docComment: docComment,
30
- type: type,
31
- accessModifiers: accessModifiers);
32
-
33
- factory Property.fromJson(Map<String, dynamic> json) =>
34
- _$PropertyFromJson(json);
35
-
36
- Map<String, dynamic> toJson() => _$PropertyToJson(this);
37
- }
38
-
39
- @JsonSerializable()
40
- class Field extends TypedDeclaration {
41
- Field(
42
- {required String name,
43
- String? docComment,
44
- required String type,
45
- List<String> accessModifiers = const []})
46
- : super(
47
- name: name,
48
- docComment: docComment,
49
- type: type,
50
- accessModifiers: accessModifiers);
51
-
52
- factory Field.fromJson(Map<String, dynamic> json) => _$FieldFromJson(json);
53
-
54
- Map<String, dynamic> toJson() => _$FieldToJson(this);
55
- }
56
-
57
- mixin ParameterAwareness {
58
- List<Parameter> _parameters = [];
59
-
60
- List<Parameter> get parameters => _parameters;
61
-
62
- set parameters(List<Parameter> value) {
63
- for (var element in value) {
64
- element.parent = this;
65
- }
66
- _parameters = value;
67
- }
68
-
69
- void addParameter(Parameter parameter) {
70
- parameter.parent = this;
71
- _parameters.add(parameter);
72
- }
73
- }
74
-
75
- @JsonSerializable()
76
- class Method extends TypedDeclaration with ParameterAwareness {
77
- Method(
78
- {required String name,
79
- String? docComment,
80
- String type = 'void',
81
- List<String> accessModifiers = const []})
82
- : super(
83
- name: name,
84
- docComment: docComment,
85
- type: type,
86
- accessModifiers: accessModifiers);
87
-
88
- factory Method.fromJson(Map<String, dynamic> json) => _$MethodFromJson(json);
89
-
90
- Map<String, dynamic> toJson() => _$MethodToJson(this);
91
-
92
- get isVoid => type.toLowerCase() == 'void';
93
- }
94
-
95
- @JsonSerializable()
96
- class Parameter extends TypedDeclaration {
97
- @JsonKey(ignore: true)
98
- ParameterAwareness? parent;
99
-
100
- Parameter(
101
- {required String name,
102
- required String type,
103
- List<String> accessModifiers = const []})
104
- : super(name: name, type: type, accessModifiers: accessModifiers);
105
-
106
- factory Parameter.fromJson(Map<String, dynamic> json) =>
107
- _$ParameterFromJson(json);
108
-
109
- Map<String, dynamic> toJson() => _$ParameterToJson(this);
110
-
111
- @override
112
- String? get docDescription {
113
- if (parent is DocsCommentAwareness) {
114
- return (parent as DocsCommentAwareness)
115
- .docComment
116
- ?.paramAnnotations
117
- .firstWhere((element) => element.paramName == name)
118
- .body;
119
- }
120
- return null;
121
- }
122
- }
123
-
124
- @JsonSerializable()
125
- class Constructor extends Declaration with ParameterAwareness {
126
- _initialize(dynamic accessModifiers, [String? docComment]) {
127
- if (accessModifiers is List<dynamic>) {
128
- accessModifiers = accessModifiers.cast<String>();
129
- }
130
- this.accessModifiers = accessModifiers;
131
- rawDocComment = docComment;
132
- }
133
-
134
- Constructor({accessModifiers = const <String>[], String? docComment})
135
- : super(name: '<init>', accessModifiers: <String>[]) {
136
- _initialize(accessModifiers, docComment);
137
- }
138
-
139
- factory Constructor.fromJson(Map<String, dynamic> json) =>
140
- _$ConstructorFromJson(json);
141
-
142
- Map<String, dynamic> toJson() => _$ConstructorToJson(this);
143
- }
@@ -1,105 +0,0 @@
1
- // GENERATED CODE - DO NOT MODIFY BY HAND
2
-
3
- part of 'members.dart';
4
-
5
- // **************************************************************************
6
- // JsonSerializableGenerator
7
- // **************************************************************************
8
-
9
- Property _$PropertyFromJson(Map<String, dynamic> json) {
10
- return Property(
11
- name: json['name'] as String,
12
- docComment: json['docComment'] as String?,
13
- type: json['type'] as String,
14
- accessModifiers: (json['access_modifiers'] as List<dynamic>)
15
- .map((e) => e as String)
16
- .toList(),
17
- )..rawDocComment = json['rawDocComment'] as String?;
18
- }
19
-
20
- Map<String, dynamic> _$PropertyToJson(Property instance) => <String, dynamic>{
21
- 'access_modifiers': instance.accessModifiers,
22
- 'rawDocComment': instance.rawDocComment,
23
- 'docComment': instance.docComment,
24
- 'name': instance.name,
25
- 'type': instance.type,
26
- };
27
-
28
- Field _$FieldFromJson(Map<String, dynamic> json) {
29
- return Field(
30
- name: json['name'] as String,
31
- docComment: json['docComment'] as String?,
32
- type: json['type'] as String,
33
- accessModifiers: (json['access_modifiers'] as List<dynamic>)
34
- .map((e) => e as String)
35
- .toList(),
36
- )..rawDocComment = json['rawDocComment'] as String?;
37
- }
38
-
39
- Map<String, dynamic> _$FieldToJson(Field instance) => <String, dynamic>{
40
- 'access_modifiers': instance.accessModifiers,
41
- 'rawDocComment': instance.rawDocComment,
42
- 'docComment': instance.docComment,
43
- 'name': instance.name,
44
- 'type': instance.type,
45
- };
46
-
47
- Method _$MethodFromJson(Map<String, dynamic> json) {
48
- return Method(
49
- name: json['name'] as String,
50
- docComment: json['docComment'] as String?,
51
- type: json['type'] as String,
52
- accessModifiers: (json['access_modifiers'] as List<dynamic>)
53
- .map((e) => e as String)
54
- .toList(),
55
- )
56
- ..rawDocComment = json['rawDocComment'] as String?
57
- ..parameters = (json['parameters'] as List<dynamic>)
58
- .map((e) => Parameter.fromJson(e as Map<String, dynamic>))
59
- .toList();
60
- }
61
-
62
- Map<String, dynamic> _$MethodToJson(Method instance) => <String, dynamic>{
63
- 'access_modifiers': instance.accessModifiers,
64
- 'rawDocComment': instance.rawDocComment,
65
- 'docComment': instance.docComment,
66
- 'name': instance.name,
67
- 'type': instance.type,
68
- 'parameters': instance.parameters,
69
- };
70
-
71
- Parameter _$ParameterFromJson(Map<String, dynamic> json) {
72
- return Parameter(
73
- name: json['name'] as String,
74
- type: json['type'] as String,
75
- accessModifiers: (json['access_modifiers'] as List<dynamic>)
76
- .map((e) => e as String)
77
- .toList(),
78
- )..rawDocComment = json['rawDocComment'] as String?;
79
- }
80
-
81
- Map<String, dynamic> _$ParameterToJson(Parameter instance) => <String, dynamic>{
82
- 'access_modifiers': instance.accessModifiers,
83
- 'rawDocComment': instance.rawDocComment,
84
- 'name': instance.name,
85
- 'type': instance.type,
86
- };
87
-
88
- Constructor _$ConstructorFromJson(Map<String, dynamic> json) {
89
- return Constructor(
90
- accessModifiers: json['access_modifiers'],
91
- docComment: json['docComment'] as String?,
92
- )
93
- ..rawDocComment = json['rawDocComment'] as String?
94
- ..parameters = (json['parameters'] as List<dynamic>)
95
- .map((e) => Parameter.fromJson(e as Map<String, dynamic>))
96
- .toList();
97
- }
98
-
99
- Map<String, dynamic> _$ConstructorToJson(Constructor instance) =>
100
- <String, dynamic>{
101
- 'access_modifiers': instance.accessModifiers,
102
- 'rawDocComment': instance.rawDocComment,
103
- 'docComment': instance.docComment,
104
- 'parameters': instance.parameters,
105
- };
@@ -1,159 +0,0 @@
1
- import 'package:apexdocs_dart/src/model/members.dart';
2
- import 'package:json_annotation/json_annotation.dart';
3
-
4
- import 'declaration.dart';
5
-
6
- part 'types.g.dart';
7
-
8
- abstract class Type extends Declaration {
9
- @JsonKey(name: 'type_name')
10
- String typeName = '';
11
-
12
- Type(
13
- {required String name,
14
- String? docComment,
15
- List<String> accessModifiers = const []})
16
- : super(
17
- name: name,
18
- docComment: docComment,
19
- accessModifiers: accessModifiers);
20
-
21
- bool isClass() {
22
- return false;
23
- }
24
-
25
- bool isInterface() {
26
- return false;
27
- }
28
-
29
- bool isEnum() {
30
- return false;
31
- }
32
-
33
- Map<String, dynamic> toJson();
34
- }
35
-
36
- mixin MethodsAwareness {
37
- List<Method> methods = [];
38
-
39
- void addMethod(Method method) {
40
- methods.add(method);
41
- }
42
- }
43
-
44
- @JsonSerializable()
45
- class ClassModel extends Type with MethodsAwareness {
46
- @JsonKey(name: 'extended_class')
47
- late final String? extendedClass;
48
- @JsonKey(name: 'implemented_interfaces')
49
- late final List<String> implementedInterfaces;
50
-
51
- List<Property> properties = [];
52
- List<Field> fields = [];
53
- List<Constructor> constructors = [];
54
- List<EnumModel> enums = [];
55
- List<InterfaceModel> interfaces = [];
56
- List<ClassModel> classes = [];
57
-
58
- ClassModel(
59
- {required String name,
60
- String? docComment,
61
- List<String> accessModifiers = const [],
62
- this.extendedClass,
63
- this.implementedInterfaces = const []})
64
- : super(
65
- name: name,
66
- docComment: docComment,
67
- accessModifiers: accessModifiers) {
68
- typeName = 'class';
69
- }
70
-
71
- factory ClassModel.fromJson(Map<String, dynamic> json) =>
72
- _$ClassModelFromJson(json);
73
-
74
- @override
75
- Map<String, dynamic> toJson() => _$ClassModelToJson(this);
76
-
77
- @override
78
- bool isClass() {
79
- return true;
80
- }
81
-
82
- void addProperty(Property property) {
83
- properties.add(property);
84
- }
85
-
86
- void addField(Field field) {
87
- fields.add(field);
88
- }
89
-
90
- void addConstructor(Constructor constructor) {
91
- constructors.add(constructor);
92
- }
93
-
94
- void addEnum(EnumModel innerEnum) {
95
- enums.add(innerEnum);
96
- }
97
-
98
- void addInterface(InterfaceModel innerInterface) {
99
- interfaces.add(innerInterface);
100
- }
101
-
102
- void addClass(ClassModel innerClass) {
103
- classes.add(innerClass);
104
- }
105
- }
106
-
107
- @JsonSerializable()
108
- class InterfaceModel extends Type with MethodsAwareness {
109
- @JsonKey(name: 'extended_interfaces')
110
- late final List<String> extendedInterfaces;
111
-
112
- InterfaceModel(
113
- {required String name,
114
- String? docComment,
115
- List<String> accessModifiers = const [],
116
- this.extendedInterfaces = const []})
117
- : super(
118
- name: name,
119
- docComment: docComment,
120
- accessModifiers: accessModifiers) {
121
- typeName = 'interface';
122
- }
123
-
124
- factory InterfaceModel.fromJson(Map<String, dynamic> json) =>
125
- _$InterfaceModelFromJson(json);
126
-
127
- @override
128
- Map<String, dynamic> toJson() => _$InterfaceModelToJson(this);
129
-
130
- @override
131
- bool isInterface() {
132
- return true;
133
- }
134
- }
135
-
136
- @JsonSerializable()
137
- class EnumModel extends Type {
138
- EnumModel(
139
- {required String name,
140
- String? docComment,
141
- List<String> accessModifiers = const []})
142
- : super(
143
- name: name,
144
- docComment: docComment,
145
- accessModifiers: accessModifiers) {
146
- typeName = 'enum';
147
- }
148
-
149
- factory EnumModel.fromJson(Map<String, dynamic> json) =>
150
- _$EnumModelFromJson(json);
151
-
152
- @override
153
- Map<String, dynamic> toJson() => _$EnumModelToJson(this);
154
-
155
- @override
156
- bool isEnum() {
157
- return true;
158
- }
159
- }