Class JavaAnnotationsMojoDescriptorExtractor
java.lang.Object
org.codehaus.plexus.logging.AbstractLogEnabled
org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor
- All Implemented Interfaces:
MojoDescriptorExtractor
,org.codehaus.plexus.logging.LogEnabled
@Component(role=MojoDescriptorExtractor.class,
hint="java-annotations")
public class JavaAnnotationsMojoDescriptorExtractor
extends org.codehaus.plexus.logging.AbstractLogEnabled
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.codehaus.plexus.archiver.manager.ArchiverManager
private org.apache.maven.artifact.factory.ArtifactFactory
private org.apache.maven.artifact.resolver.ArtifactResolver
private MojoAnnotationsScanner
Fields inherited from interface org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiscoverClasses
(String encoding, List<File> sourceDirectories, Set<org.apache.maven.artifact.Artifact> artifacts) discoverClasses
(String encoding, org.apache.maven.project.MavenProject project) discoverClasses
(PluginToolsRequest request) discoverClassesFromSourcesJar
(org.apache.maven.artifact.Artifact artifact, PluginToolsRequest request, String classifier) List<org.apache.maven.plugin.descriptor.MojoDescriptor>
execute
(PluginToolsRequest request) Execute the mojo extraction.extractFieldParameterTags
(com.thoughtworks.qdox.model.JavaClass javaClass, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) extract fields that are either parameters or components.protected ExecuteAnnotationContent
findExecuteInParentHierarchy
(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) private com.thoughtworks.qdox.model.DocletTag
findInClassHierarchy
(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, ComponentAnnotationContent> components, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) protected org.apache.maven.project.MavenProject
getFromProjectReferences
(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.MavenProject project) protected List<ParameterAnnotationContent>
getParametersParent
(MojoAnnotatedClass mojoAnnotatedClass, List<ParameterAnnotationContent> parameterAnnotationContents, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) protected Map<String,
ParameterAnnotationContent> getParametersParentHierarchy
(MojoAnnotatedClass mojoAnnotatedClass, Map<String, ParameterAnnotationContent> parameters, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) private boolean
isMojoAnnnotatedClassCandidate
(MojoAnnotatedClass mojoAnnotatedClass) protected void
populateDataFromJavadoc
(Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) from sources scan to get @since and @deprecated and description of classes and fields.private Map<String,
MojoAnnotatedClass> scanAnnotations
(PluginToolsRequest request) scanJavadoc
(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 org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
mojoAnnotationsScanner
-
artifactResolver
@Requirement private org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver -
artifactFactory
@Requirement private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory -
archiverManager
@Requirement private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
-
-
Constructor Details
-
JavaAnnotationsMojoDescriptorExtractor
public JavaAnnotationsMojoDescriptorExtractor()
-
-
Method Details
-
execute
public List<org.apache.maven.plugin.descriptor.MojoDescriptor> execute(PluginToolsRequest request) throws ExtractionException, org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException Description copied from interface:MojoDescriptorExtractor
Execute the mojo extraction.- Specified by:
execute
in interfaceMojoDescriptorExtractor
- Parameters:
request
- ThePluginToolsRequest
containing information for the extraction process.- Returns:
- a list of mojo descriptors.
- 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 Map<String,com.thoughtworks.qdox.model.JavaClass> scanJavadoc(PluginToolsRequest request, Collection<MojoAnnotatedClass> mojoAnnotatedClasses) throws ExtractionException - Throws:
ExtractionException
-
isMojoAnnnotatedClassCandidate
-
discoverClassesFromSourcesJar
protected Map<String,com.thoughtworks.qdox.model.JavaClass> discoverClassesFromSourcesJar(org.apache.maven.artifact.Artifact artifact, PluginToolsRequest request, String classifier) throws ExtractionException - Throws:
ExtractionException
-
populateDataFromJavadoc
protected void populateDataFromJavadoc(Map<String, MojoAnnotatedClass> mojoAnnotatedClasses, Map<String, com.thoughtworks.qdox.model.JavaClass> javaClassesMap) from sources scan to get @since and @deprecated and description of classes and fields.- Parameters:
mojoAnnotatedClasses
-javaClassesMap
-
-
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
-
extractFieldParameterTags
private Map<String,com.thoughtworks.qdox.model.JavaField> extractFieldParameterTags(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
-
discoverClasses
protected Map<String,com.thoughtworks.qdox.model.JavaClass> discoverClasses(PluginToolsRequest request) -
discoverClasses
-
discoverClasses
-
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.DuplicateParameterException, org.apache.maven.plugin.descriptor.InvalidParameterException- Throws:
org.apache.maven.plugin.descriptor.DuplicateParameterException
org.apache.maven.plugin.descriptor.InvalidParameterException
-
findExecuteInParentHierarchy
protected ExecuteAnnotationContent findExecuteInParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, MojoAnnotatedClass> mojoAnnotatedClasses) -
getParametersParentHierarchy
protected Map<String,ParameterAnnotationContent> getParametersParentHierarchy(MojoAnnotatedClass mojoAnnotatedClass, Map<String, ParameterAnnotationContent> parameters, 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, ComponentAnnotationContent> components, 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)
-