Package adams.core.annotation
Class AbstractCopyrightProcessor<T extends Annotation>
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- adams.core.annotation.AbstractCopyrightProcessor<T>
-
- All Implemented Interfaces:
Processor
- Direct Known Subclasses:
MixedCopyrightProcessor
,ThirdPartyCopyrightProcessor
public abstract class AbstractCopyrightProcessor<T extends Annotation> extends AbstractProcessor
A processor that lists all classes/methods with mixed copyright.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
MixedCopyright
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_IsFirst
whether the output represents the first one.-
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
-
Constructor Summary
Constructors Constructor Description AbstractCopyrightProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Class
getAnnotationClass()
Returns the annotation class to process.protected abstract String
getDataRow(T copyright, String module, String cls, String method)
Returns a data row for a specific annotation.protected abstract String
getHeaderRow()
Returns the header row for the tab-separated output file.protected abstract String
getOutputFile(String prefix)
Returns the output file to write the information to.Set<String>
getSupportedAnnotationTypes()
If the processor class is annotated withSupportedAnnotationTypes
, return an unmodifiable set with the same set of strings as the annotation.Set<String>
getSupportedOptions()
If the processor class is annotated withSupportedOptions
, return an unmodifiable set with the same set of strings as the annotation.SourceVersion
getSupportedSourceVersion()
If the processor class is annotated withSupportedSourceVersion
, return the source version in the annotation.boolean
process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
Processes a set of annotation types on type elements originating from the prior round and returns whether or not these annotations are claimed by this processor.-
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, init, isInitialized
-
-
-
-
Method Detail
-
getSupportedSourceVersion
public SourceVersion getSupportedSourceVersion()
If the processor class is annotated withSupportedSourceVersion
, return the source version in the annotation. If the class is not so annotated,SourceVersion.RELEASE_11
is returned.- Specified by:
getSupportedSourceVersion
in interfaceProcessor
- Overrides:
getSupportedSourceVersion
in classAbstractProcessor
- Returns:
- the latest source version supported by this processor
-
getSupportedOptions
public Set<String> getSupportedOptions()
If the processor class is annotated withSupportedOptions
, 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 interfaceProcessor
- Overrides:
getSupportedOptions
in classAbstractProcessor
- Returns:
- the options recognized by this processor, or an empty set if none
-
getSupportedAnnotationTypes
public Set<String> getSupportedAnnotationTypes()
If the processor class is annotated withSupportedAnnotationTypes
, 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:
getSupportedAnnotationTypes
in interfaceProcessor
- Overrides:
getSupportedAnnotationTypes
in classAbstractProcessor
- Returns:
- the names of the annotation types supported by this processor, or an empty set if none
-
getAnnotationClass
protected abstract Class getAnnotationClass()
Returns the annotation class to process.- Returns:
- the class
-
getOutputFile
protected abstract String getOutputFile(String prefix)
Returns the output file to write the information to.- Parameters:
prefix
- the path/filename prefix- Returns:
- the full path/filename
-
getHeaderRow
protected abstract String getHeaderRow()
Returns the header row for the tab-separated output file.- Returns:
- the header row
-
getDataRow
protected abstract String getDataRow(T copyright, String module, String cls, String method)
Returns a data row for a specific annotation.- Parameters:
copyright
- the copyright annotation to usemodule
- the module to usecls
- the class the annotation is located inmethod
- the method the annotation is located in, empty string if not applicable
-
process
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
Processes a set of annotation types on type elements originating from the prior round and returns whether or not these annotations are claimed by this processor. Iftrue
is returned, the annotations are claimed and subsequent processors will not be asked to process them; iffalse
is returned, the annotations are unclaimed and subsequent processors may be asked to process them. A processor may always return the same boolean value or may vary the result based on chosen criteria.The input set will be empty if the processor supports
"*"
and the root elements have no annotations. AProcessor
must gracefully handle an empty set of annotations.- Specified by:
process
in interfaceProcessor
- Specified by:
process
in classAbstractProcessor
- Parameters:
annotations
- the annotation types requested to be processedroundEnv
- environment for information about the current and prior round- Returns:
- whether or not the set of annotations are claimed by this processor
-
-