in maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java [302:395]
protected void populateDataFromJavadoc(
JavaProjectBuilder javaProjectBuilder,
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses,
Map<String, JavaClass> javaClassesMap,
JavadocLinkGenerator linkGenerator) {
for (Map.Entry<String, MojoAnnotatedClass> entry : mojoAnnotatedClasses.entrySet()) {
JavaClass javaClass = javaClassesMap.get(entry.getKey());
if (javaClass == null) {
continue;
}
// populate class-level content
MojoAnnotationContent mojoAnnotationContent = entry.getValue().getMojo();
if (mojoAnnotationContent != null) {
JavaClassConverterContext context = new JavaClassConverterContext(
javaClass, javaProjectBuilder, mojoAnnotatedClasses, linkGenerator, javaClass.getLineNumber());
mojoAnnotationContent.setDescription(getDescriptionFromElement(javaClass, context));
DocletTag since = findInClassHierarchy(javaClass, "since");
if (since != null) {
mojoAnnotationContent.setSince(getRawValueFromTaglet(since, context));
}
DocletTag deprecated = findInClassHierarchy(javaClass, "deprecated");
if (deprecated != null) {
mojoAnnotationContent.setDeprecated(getRawValueFromTaglet(deprecated, context));
}
}
Map<String, JavaAnnotatedElement> fieldsMap = extractFieldsAnnotations(javaClass, javaClassesMap);
Map<String, JavaAnnotatedElement> methodsMap = extractMethodsAnnotations(javaClass, javaClassesMap);
// populate parameters
Map<String, ParameterAnnotationContent> parameters =
getParametersParentHierarchy(entry.getValue(), mojoAnnotatedClasses);
parameters = new TreeMap<>(parameters);
for (Map.Entry<String, ParameterAnnotationContent> parameter : parameters.entrySet()) {
JavaAnnotatedElement element;
if (parameter.getValue().isAnnotationOnMethod()) {
element = methodsMap.get(parameter.getKey());
} else {
element = fieldsMap.get(parameter.getKey());
}
if (element == null) {
continue;
}
JavaClassConverterContext context = new JavaClassConverterContext(
javaClass, ((JavaMember) element).getDeclaringClass(),
javaProjectBuilder, mojoAnnotatedClasses,
linkGenerator, element.getLineNumber());
ParameterAnnotationContent parameterAnnotationContent = parameter.getValue();
parameterAnnotationContent.setDescription(getDescriptionFromElement(element, context));
DocletTag deprecated = element.getTagByName("deprecated");
if (deprecated != null) {
parameterAnnotationContent.setDeprecated(getRawValueFromTaglet(deprecated, context));
}
DocletTag since = element.getTagByName("since");
if (since != null) {
parameterAnnotationContent.setSince(getRawValueFromTaglet(since, context));
}
}
// populate components
Map<String, ComponentAnnotationContent> components =
entry.getValue().getComponents();
for (Map.Entry<String, ComponentAnnotationContent> component : components.entrySet()) {
JavaAnnotatedElement element = fieldsMap.get(component.getKey());
if (element == null) {
continue;
}
JavaClassConverterContext context = new JavaClassConverterContext(
javaClass, ((JavaMember) element).getDeclaringClass(),
javaProjectBuilder, mojoAnnotatedClasses,
linkGenerator, javaClass.getLineNumber());
ComponentAnnotationContent componentAnnotationContent = component.getValue();
componentAnnotationContent.setDescription(getDescriptionFromElement(element, context));
DocletTag deprecated = element.getTagByName("deprecated");
if (deprecated != null) {
componentAnnotationContent.setDeprecated(getRawValueFromTaglet(deprecated, context));
}
DocletTag since = element.getTagByName("since");
if (since != null) {
componentAnnotationContent.setSince(getRawValueFromTaglet(since, context));
}
}
}
}