16
16
17
17
package com .github .therapi .runtimejavadoc ;
18
18
19
- import com .github .therapi .runtimejavadoc .internal .MethodJavadocKey ;
20
- import static com .github .therapi .runtimejavadoc .internal .RuntimeJavadocHelper .executableToMethodJavadocKey ;
21
- import static com .github .therapi .runtimejavadoc .internal .RuntimeJavadocHelper .getAllTypeAncestors ;
19
+ import com .github .therapi .runtimejavadoc .internal .MethodSignature ;
20
+
22
21
import java .lang .reflect .Constructor ;
23
22
import java .lang .reflect .Field ;
24
23
import java .lang .reflect .Method ;
30
29
import java .util .List ;
31
30
import java .util .Map ;
32
31
32
+ import static com .github .therapi .runtimejavadoc .internal .RuntimeJavadocHelper .getAllTypeAncestors ;
33
+
33
34
public class ClassJavadoc extends BaseJavadoc {
34
35
private final Map <String , FieldJavadoc > fields ;
35
36
private final Map <String , FieldJavadoc > enumConstants ;
36
- private final Map <MethodJavadocKey , MethodJavadoc > methods ;
37
- private final Map <MethodJavadocKey , MethodJavadoc > constructors ;
37
+ private final Map <MethodSignature , MethodJavadoc > methods ;
38
+ private final Map <MethodSignature , MethodJavadoc > constructors ;
38
39
private final Map <String , ParamJavadoc > recordComponents ;
39
40
40
41
public ClassJavadoc (String name , Comment comment , List <FieldJavadoc > fields , List <FieldJavadoc > enumConstants ,
@@ -54,16 +55,16 @@ public ClassJavadoc(String name, Comment comment, List<FieldJavadoc> fields, Lis
54
55
}
55
56
this .enumConstants = Collections .unmodifiableMap (enumMap );
56
57
57
- Map <MethodJavadocKey , MethodJavadoc > methodsMap = new LinkedHashMap <>();
58
+ Map <MethodSignature , MethodJavadoc > methodsMap = new LinkedHashMap <>();
58
59
if (methods != null ) {
59
- methods .forEach (methodJavadoc -> methodsMap .put (methodJavadoc . toMethodJavadocKey ( ), methodJavadoc ));
60
+ methods .forEach (methodJavadoc -> methodsMap .put (MethodSignature . from ( methodJavadoc ), methodJavadoc ));
60
61
}
61
62
this .methods = Collections .unmodifiableMap (methodsMap );
62
63
63
- Map <MethodJavadocKey , MethodJavadoc > constructorsMap = new LinkedHashMap <>();
64
+ Map <MethodSignature , MethodJavadoc > constructorsMap = new LinkedHashMap <>();
64
65
if (constructors != null ) {
65
66
constructors .forEach (
66
- methodJavadoc -> constructorsMap .put (methodJavadoc . toMethodJavadocKey ( ), methodJavadoc ));
67
+ methodJavadoc -> constructorsMap .put (MethodSignature . from ( methodJavadoc ), methodJavadoc ));
67
68
}
68
69
this .constructors = Collections .unmodifiableMap (constructorsMap );
69
70
@@ -75,8 +76,8 @@ public ClassJavadoc(String name, Comment comment, List<FieldJavadoc> fields, Lis
75
76
}
76
77
77
78
private ClassJavadoc (String name , Comment comment , Map <String , FieldJavadoc > fields ,
78
- Map <String , FieldJavadoc > enumConstants , Map <MethodJavadocKey , MethodJavadoc > methods ,
79
- Map <MethodJavadocKey , MethodJavadoc > constructors , List <OtherJavadoc > other ,
79
+ Map <String , FieldJavadoc > enumConstants , Map <MethodSignature , MethodJavadoc > methods ,
80
+ Map <MethodSignature , MethodJavadoc > constructors , List <OtherJavadoc > other ,
80
81
List <SeeAlsoJavadoc > seeAlso , Map <String , ParamJavadoc > recordComponents ) {
81
82
super (name , comment , seeAlso , other );
82
83
this .fields = Collections .unmodifiableMap (fields );
@@ -110,9 +111,9 @@ ClassJavadoc createEnhancedClassJavadoc(Class<?> clazz) {
110
111
classJavadocCache .put (clazz .getCanonicalName (), this );
111
112
getAllTypeAncestors (clazz ).forEach (cls -> classJavadocCache .put (cls .getCanonicalName (), RuntimeJavadoc .getSkinnyClassJavadoc (cls )));
112
113
113
- Map <MethodJavadocKey , MethodJavadoc > methodJavadocs = new LinkedHashMap <>();
114
+ Map <MethodSignature , MethodJavadoc > methodJavadocs = new LinkedHashMap <>();
114
115
Arrays .stream (clazz .getDeclaredMethods ())
115
- .forEach (method -> methodJavadocs .put (executableToMethodJavadocKey (method ),
116
+ .forEach (method -> methodJavadocs .put (MethodSignature . from (method ),
116
117
RuntimeJavadoc .getJavadoc (method , classJavadocCache )));
117
118
118
119
return new ClassJavadoc (getName (), getComment (), fields , enumConstants , methodJavadocs , constructors ,
@@ -155,13 +156,13 @@ FieldJavadoc findMatchingEnumConstant(Enum<?> enumConstant) {
155
156
}
156
157
157
158
MethodJavadoc findMatchingMethod (Method method ) {
158
- MethodJavadocKey methodJavadocKey = executableToMethodJavadocKey (method );
159
- return methods .getOrDefault (methodJavadocKey , MethodJavadoc .createEmpty (method ));
159
+ MethodSignature methodSignature = MethodSignature . from (method );
160
+ return methods .getOrDefault (methodSignature , MethodJavadoc .createEmpty (method ));
160
161
}
161
162
162
163
MethodJavadoc findMatchingConstructor (Constructor <?> constructor ) {
163
- MethodJavadocKey methodJavadocKey = executableToMethodJavadocKey (constructor );
164
- return constructors .getOrDefault (methodJavadocKey , MethodJavadoc .createEmpty (constructor ));
164
+ MethodSignature methodSignature = MethodSignature . from (constructor );
165
+ return constructors .getOrDefault (methodSignature , MethodJavadoc .createEmpty (constructor ));
165
166
}
166
167
167
168
ParamJavadoc findRecordComponent (String recordComponent ) {
0 commit comments