Class JavaAnnotationsMojoDescriptorExtractor
java.lang.Object
org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor
- All Implemented Interfaces:
MojoDescriptorExtractor
@Named("java-annotations")
@Singleton
public class JavaAnnotationsMojoDescriptorExtractor
extends Object
implements MojoDescriptorExtractor
JavaMojoDescriptorExtractor, a MojoDescriptor extractor to read descriptors from java classes with annotations.
Notice that source files are also parsed to get description, since and deprecation information.
- Since:
- 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classCompares class file format versions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.codehaus.plexus.archiver.manager.ArchiverManagerprivate static final GroupKeyprivate JavadocBlockTagsToXhtmlConverterprivate static final org.slf4j.Logger(package private) MojoAnnotationsScannerstatic final Stringprivate org.eclipse.aether.RepositorySystem -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiscoverClasses(com.thoughtworks.qdox.JavaProjectBuilder builder) List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(PluginToolsRequest request) Execute the mojo extraction.private voidextendJavaProjectBuilder(com.thoughtworks.qdox.JavaProjectBuilder builder, List<File> sourceDirectories, Set<org.apache.maven.artifact.Artifact> artifacts) private voidextendJavaProjectBuilder(com.thoughtworks.qdox.JavaProjectBuilder builder, org.apache.maven.project.MavenProject project) protected voidextendJavaProjectBuilderWithSourcesJar(com.thoughtworks.qdox.JavaProjectBuilder builder, org.apache.maven.artifact.Artifact artifact, PluginToolsRequest request, String classifier) extractFieldsAnnotations(com.thoughtworks.qdox.model.JavaClass javaClass, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) extract fields that are either parameters or components.extractMethodsAnnotations(com.thoughtworks.qdox.model.JavaClass javaClass, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) extract methods that are parameters.protected MojoAnnotatedClassfindClassWithExecuteAnnotationInParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) private com.thoughtworks.qdox.model.DocletTagfindInClassHierarchy(com.thoughtworks.qdox.model.JavaClass javaClass, String tagName) protected List<ComponentAnnotationContent> getComponentParent(MojoAnnotatedClass mojoAnnotatedClass, List<ComponentAnnotationContent> componentAnnotationContents, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) protected Map<String, ComponentAnnotationContent> getComponentsParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) (package private) StringgetDescriptionFromElement(com.thoughtworks.qdox.model.JavaAnnotatedElement element, JavaClassConverterContext context) Returns the XHTML description from the given element.protected org.apache.maven.project.MavenProjectgetFromProjectReferences(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.MavenProject project) Returns theGroupKeyof extractor, asMojoScannerwill execute them grouped, and ordered within groups.getName()Returns the "name" (id) of the extractor.protected List<ParameterAnnotationContent> getParametersParent(MojoAnnotatedClass mojoAnnotatedClass, List<ParameterAnnotationContent> parameterAnnotationContents, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) protected Map<String, ParameterAnnotationContent> getParametersParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) (package private) StringgetRawValueFromTaglet(com.thoughtworks.qdox.model.DocletTag docletTag, ConverterContext context) booleanReturnstrueif extractor is deprecated.private booleanisMojoAnnnotatedClassCandidate(MojoAnnotatedClass mojoAnnotatedClass) private booleanisPublicSetterMethod(com.thoughtworks.qdox.model.JavaMethod method) protected voidpopulateDataFromJavadoc(com.thoughtworks.qdox.JavaProjectBuilder javaProjectBuilder, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap, JavadocLinkGenerator linkGenerator) from sources scan to get @since and @deprecated and description of classes and fields.private Map<String, MojoAnnotatedClass> scanAnnotations(PluginToolsRequest request) private com.thoughtworks.qdox.JavaProjectBuilderscanJavadoc(PluginToolsRequest request, Collection<MojoAnnotatedClass> mojoAnnotatedClasses) private List<org.apache.maven.plugin.descriptor.MojoDescriptor> toMojoDescriptors(Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor
getRequiredJavaVersion
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
NAME
- See Also:
-
GROUP_KEY
-
CLASS_VERSION_TO_JAVA_STRING
- See Also:
-
mojoAnnotationsScanner
-
repositorySystem
@Inject private org.eclipse.aether.RepositorySystem repositorySystem -
archiverManager
@Inject private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager -
javadocInlineTagsToHtmlConverter
-
javadocBlockTagsToHtmlConverter
-
-
Constructor Details
-
JavaAnnotationsMojoDescriptorExtractor
public JavaAnnotationsMojoDescriptorExtractor()
-
-
Method Details
-
getName
Description copied from interface:MojoDescriptorExtractorReturns the "name" (id) of the extractor.- Specified by:
getNamein interfaceMojoDescriptorExtractor
-
isDeprecated
public boolean isDeprecated()Description copied from interface:MojoDescriptorExtractorReturnstrueif extractor is deprecated.- Specified by:
isDeprecatedin interfaceMojoDescriptorExtractor
-
getGroupKey
Description copied from interface:MojoDescriptorExtractorReturns theGroupKeyof extractor, asMojoScannerwill execute them grouped, and ordered within groups. Must never returnnull.- Specified by:
getGroupKeyin interfaceMojoDescriptorExtractor
-
execute
public List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(PluginToolsRequest request) throws ExtractionException, org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException Description copied from interface:MojoDescriptorExtractorExecute the mojo extraction.- Specified by:
executein interfaceMojoDescriptorExtractor- Parameters:
request- ThePluginToolsRequestcontaining information for the extraction process.- Returns:
- a list of mojo descriptors. These may return HTML values for some fields.
- Throws:
ExtractionException- if anyorg.apache.maven.plugin.descriptor.InvalidPluginDescriptorException- if any
-
scanAnnotations
private Map<String,MojoAnnotatedClass> scanAnnotations(PluginToolsRequest request) throws ExtractionException - Throws:
ExtractionException
-
scanJavadoc
private com.thoughtworks.qdox.JavaProjectBuilder scanJavadoc(PluginToolsRequest request, Collection<MojoAnnotatedClass> mojoAnnotatedClasses) throws ExtractionException - Throws:
ExtractionException
-
isMojoAnnnotatedClassCandidate
-
populateDataFromJavadoc
protected void populateDataFromJavadoc(com.thoughtworks.qdox.JavaProjectBuilder javaProjectBuilder, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap, JavadocLinkGenerator linkGenerator) from sources scan to get @since and @deprecated and description of classes and fields. -
getDescriptionFromElement
String getDescriptionFromElement(com.thoughtworks.qdox.model.JavaAnnotatedElement element, JavaClassConverterContext context) Returns the XHTML description from the given element. This may refer to either goal, parameter or component.- Parameters:
element- the element for which to generate the descriptioncontext- the context with which to call the converter- Returns:
- the generated description
-
getRawValueFromTaglet
String getRawValueFromTaglet(com.thoughtworks.qdox.model.DocletTag docletTag, ConverterContext context) -
findInClassHierarchy
private com.thoughtworks.qdox.model.DocletTag findInClassHierarchy(com.thoughtworks.qdox.model.JavaClass javaClass, String tagName) - Parameters:
javaClass- not nulltagName- not null- Returns:
- docletTag instance
-
extractFieldsAnnotations
private Map<String,com.thoughtworks.qdox.model.JavaAnnotatedElement> extractFieldsAnnotations(com.thoughtworks.qdox.model.JavaClass javaClass, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) extract fields that are either parameters or components.- Parameters:
javaClass- not null- Returns:
- map with Mojo parameters names as keys
-
extractMethodsAnnotations
private Map<String,com.thoughtworks.qdox.model.JavaAnnotatedElement> extractMethodsAnnotations(com.thoughtworks.qdox.model.JavaClass javaClass, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) extract methods that are parameters.- Parameters:
javaClass- not null- Returns:
- map with Mojo parameters names as keys
-
isPublicSetterMethod
private boolean isPublicSetterMethod(com.thoughtworks.qdox.model.JavaMethod method) -
discoverClasses
-
extendJavaProjectBuilderWithSourcesJar
protected void extendJavaProjectBuilderWithSourcesJar(com.thoughtworks.qdox.JavaProjectBuilder builder, org.apache.maven.artifact.Artifact artifact, PluginToolsRequest request, String classifier) throws ExtractionException - Throws:
ExtractionException
-
extendJavaProjectBuilder
private void extendJavaProjectBuilder(com.thoughtworks.qdox.JavaProjectBuilder builder, org.apache.maven.project.MavenProject project) -
extendJavaProjectBuilder
-
toMojoDescriptors
private List<org.apache.maven.plugin.descriptor.MojoDescriptor> toMojoDescriptors(Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) throws org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException- Throws:
org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
-
findClassWithExecuteAnnotationInParentHierarchy
protected MojoAnnotatedClass findClassWithExecuteAnnotationInParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getParametersParentHierarchy
protected Map<String,ParameterAnnotationContent> getParametersParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getParametersParent
protected List<ParameterAnnotationContent> getParametersParent(MojoAnnotatedClass mojoAnnotatedClass, List<ParameterAnnotationContent> parameterAnnotationContents, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getComponentsParentHierarchy
protected Map<String,ComponentAnnotationContent> getComponentsParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getComponentParent
protected List<ComponentAnnotationContent> getComponentParent(MojoAnnotatedClass mojoAnnotatedClass, List<ComponentAnnotationContent> componentAnnotationContents, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getFromProjectReferences
protected org.apache.maven.project.MavenProject getFromProjectReferences(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.MavenProject project)
-