Class JavaAnnotationsMojoDescriptorExtractor

  • All Implemented Interfaces:
    MojoDescriptorExtractor, org.codehaus.plexus.logging.LogEnabled

    @Named("java-annotations")
    @Singleton
    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 Detail

      • GROUP_KEY

        private static final GroupKey GROUP_KEY
      • CLASS_VERSION_TO_JAVA_STRING

        private static final java.util.Map<java.lang.Integer,​java.lang.String> CLASS_VERSION_TO_JAVA_STRING
        See Also:
        JVMS 4.1
      • repositorySystem

        @Inject
        private org.eclipse.aether.RepositorySystem repositorySystem
      • archiverManager

        @Inject
        private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
    • Constructor Detail

      • JavaAnnotationsMojoDescriptorExtractor

        public JavaAnnotationsMojoDescriptorExtractor()
    • Method Detail

      • execute

        public java.util.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 interface MojoDescriptorExtractor
        Parameters:
        request - The PluginToolsRequest containing information for the extraction process.
        Returns:
        a list of mojo descriptors. These may return HTML values for some fields.
        Throws:
        ExtractionException - if any
        org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException - if any
      • isMojoAnnnotatedClassCandidate

        private boolean isMojoAnnnotatedClassCandidate​(MojoAnnotatedClass mojoAnnotatedClass)
      • populateDataFromJavadoc

        protected void populateDataFromJavadoc​(com.thoughtworks.qdox.JavaProjectBuilder javaProjectBuilder,
                                               java.util.Map<java.lang.String,​MojoAnnotatedClass> mojoAnnotatedClasses,
                                               java.util.Map<java.lang.String,​com.thoughtworks.qdox.model.JavaClass> javaClassesMap,
                                               JavadocLinkGenerator linkGenerator)
        from sources scan to get @since and @deprecated and description of classes and fields.
      • getDescriptionFromElement

        java.lang.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 description
        context - the context with which to call the converter
        Returns:
        the generated description
      • getRawValueFromTaglet

        java.lang.String getRawValueFromTaglet​(com.thoughtworks.qdox.model.DocletTag docletTag,
                                               ConverterContext context)
      • findInClassHierarchy

        private com.thoughtworks.qdox.model.DocletTag findInClassHierarchy​(com.thoughtworks.qdox.model.JavaClass javaClass,
                                                                           java.lang.String tagName)
        Parameters:
        javaClass - not null
        tagName - not null
        Returns:
        docletTag instance
      • extractFieldsAnnotations

        private java.util.Map<java.lang.String,​com.thoughtworks.qdox.model.JavaAnnotatedElement> extractFieldsAnnotations​(com.thoughtworks.qdox.model.JavaClass javaClass,
                                                                                                                                java.util.Map<java.lang.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 java.util.Map<java.lang.String,​com.thoughtworks.qdox.model.JavaAnnotatedElement> extractMethodsAnnotations​(com.thoughtworks.qdox.model.JavaClass javaClass,
                                                                                                                                 java.util.Map<java.lang.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

        protected java.util.Map<java.lang.String,​com.thoughtworks.qdox.model.JavaClass> discoverClasses​(com.thoughtworks.qdox.JavaProjectBuilder builder)
      • extendJavaProjectBuilderWithSourcesJar

        protected void extendJavaProjectBuilderWithSourcesJar​(com.thoughtworks.qdox.JavaProjectBuilder builder,
                                                              org.apache.maven.artifact.Artifact artifact,
                                                              PluginToolsRequest request,
                                                              java.lang.String classifier)
                                                       throws ExtractionException
        Throws:
        ExtractionException
      • extendJavaProjectBuilder

        private void extendJavaProjectBuilder​(com.thoughtworks.qdox.JavaProjectBuilder builder,
                                              org.apache.maven.project.MavenProject project)
      • extendJavaProjectBuilder

        private void extendJavaProjectBuilder​(com.thoughtworks.qdox.JavaProjectBuilder builder,
                                              java.util.List<java.io.File> sourceDirectories,
                                              java.util.Set<org.apache.maven.artifact.Artifact> artifacts)
      • toMojoDescriptors

        private java.util.List<org.apache.maven.plugin.descriptor.MojoDescriptor> toMojoDescriptors​(java.util.Map<java.lang.String,​MojoAnnotatedClass> mojoAnnotatedClasses,
                                                                                                    org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
                                                                                             throws org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
        Throws:
        org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException
      • getFromProjectReferences

        protected org.apache.maven.project.MavenProject getFromProjectReferences​(org.apache.maven.artifact.Artifact artifact,
                                                                                 org.apache.maven.project.MavenProject project)