Module java.compiler

Class AbstractProcessor

  • All Implemented Interfaces:
    Processor

    public abstract class AbstractProcessor
    extends Object
    implements Processor
    An abstract annotation processor designed to be a convenient superclass for most concrete annotation processors. This class examines annotation values to compute the options, annotation types, and source version supported by its subtypes.

    The getter methods may issue warnings about noteworthy conditions using the facilities available after the processor has been initialized.

    Subclasses are free to override the implementation and specification of any of the methods in this class as long as the general Processor contract for that method is obeyed.

    Since:
    1.6
    • Field Detail

      • processingEnv

        protected ProcessingEnvironment processingEnv
        Processing environment providing by the tool framework.
    • Constructor Detail

      • AbstractProcessor

        protected AbstractProcessor()
        Constructor for subclasses to call.
    • Method Detail

      • getSupportedOptions

        public Set<String> getSupportedOptions()
        If the processor class is annotated with SupportedOptions, return an unmodifiable set with the same set of strings as the annotation. If the class is not so annotated, an empty set is returned.
        Specified by:
        getSupportedOptions in interface Processor
        Returns:
        the options recognized by this processor, or an empty set if none
        See Also:
        SupportedOptions
      • init

        public void init​(ProcessingEnvironment processingEnv)
        Initializes the processor with the processing environment by setting the processingEnv field to the value of the processingEnv argument. An IllegalStateException will be thrown if this method is called more than once on the same object.
        Specified by:
        init in interface Processor
        Parameters:
        processingEnv - environment to access facilities the tool framework provides to the processor
        Throws:
        IllegalStateException - if this method is called more than once.
      • getCompletions

        public Iterable<? extends Completion> getCompletions​(Element element,
                                                             AnnotationMirror annotation,
                                                             ExecutableElement member,
                                                             String userText)
        Returns an empty iterable of completions.
        Specified by:
        getCompletions in interface Processor
        Parameters:
        element - the element being annotated
        annotation - the (perhaps partial) annotation being applied to the element
        member - the annotation member to return possible completions for
        userText - source code text to be completed
        Returns:
        suggested completions to the annotation
      • isInitialized

        protected boolean isInitialized()
        Returns true if this object has been initialized, false otherwise.
        Returns:
        true if this object has been initialized, false otherwise.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部