@@ -97,21 +97,36 @@ public void addConfigRoot(final PackageElement pkg, TypeElement clazz) {
97
97
}
98
98
}
99
99
100
+ String docFileName = null ;
101
+ for (AnnotationMirror mirror : clazz .getAnnotationMirrors ()) {
102
+ if (mirror .getAnnotationType ().toString ().equals (Constants .ANNOTATION_CONFIG_DOC_FILE_NAME )) {
103
+ for (Entry <? extends ExecutableElement , ? extends AnnotationValue > entry : mirror .getElementValues ()
104
+ .entrySet ()) {
105
+ if ("value()" .equals (entry .getKey ().toString ())) {
106
+ docFileName = entry .getValue ().getValue ().toString ();
107
+ break ;
108
+ }
109
+ }
110
+ break ;
111
+ }
112
+ }
113
+
100
114
name = getName (prefix , name , clazz .getSimpleName ().toString (), configPhase );
101
115
if (name .endsWith (Constants .DOT + Constants .PARENT )) {
102
116
// take into account the root case which would contain characters that can't be used to create the final file
103
117
name = name .replace (Constants .DOT + Constants .PARENT , "" );
104
118
}
105
119
106
- final Matcher pkgMatcher = Constants .PKG_PATTERN .matcher (pkg .toString ());
107
- final String fileName ;
108
- if (pkgMatcher .find ()) {
109
- fileName = DocGeneratorUtil .computeExtensionDocFileName (clazz .toString ());
110
- } else {
111
- fileName = name .replace (Constants .DOT , Constants .DASH .charAt (0 )) + Constants .ADOC_EXTENSION ;
120
+ if (docFileName == null || docFileName .isEmpty ()) {
121
+ final Matcher pkgMatcher = Constants .PKG_PATTERN .matcher (pkg .toString ());
122
+ if (pkgMatcher .find ()) {
123
+ docFileName = DocGeneratorUtil .computeExtensionDocFileName (clazz .toString ());
124
+ } else {
125
+ docFileName = name .replace (Constants .DOT , Constants .DASH .charAt (0 ))
126
+ + Constants .ADOC_EXTENSION ;
127
+ }
112
128
}
113
-
114
- ConfigRootInfo configRootInfo = new ConfigRootInfo (name , clazz , configPhase , fileName );
129
+ ConfigRootInfo configRootInfo = new ConfigRootInfo (name , clazz , configPhase , docFileName );
115
130
configRoots .add (configRootInfo );
116
131
break ;
117
132
}
0 commit comments