Class PluginProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
- All Implemented Interfaces:
Processor
@SupportedAnnotationTypes("org.apache.logging.log4j.core.config.plugins.Plugin")
@SupportedOptions("log4j.plugin.processor.minAllowedMessageKind")
public class PluginProcessor
extends AbstractProcessor
Annotation processor for pre-scanning Log4j 2 plugins.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classElementVisitor to scan the PluginAliases annotation.private static final classElementVisitor to scan the Plugin annotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Element[](package private) static final StringAnnotation processor option that controls the minimumDiagnostic.Kindof messages emitted by this processor.private Diagnostic.Kindprivate static final Stringstatic final StringThe location of the plugin cache data file.private final PluginCacheprivate static final StringFields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcollectPlugins(Iterable<? extends Element> elements) private static StringexpectedFieldNameInASetter(String fieldName) Helper method to get the expected Method name in a field.voidinit(ProcessingEnvironment processingEnv) private voidprintMessage(Diagnostic.Kind kind, String message) Prints a message via theMessageronly ifkindis at least as severe as the configuredminimum allowed kind.private voidprintMessage(Diagnostic.Kind kind, String message, Element element) Prints a message via theMessageronly ifkindis at least as severe as the configuredminimum allowed kind.booleanprocess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) private voidprocessBuilderAttribute(Iterable<? extends Element> elements) private voidprocessBuilderAttribute(VariableElement element) private voidwriteCacheFile(Element... elements) Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
-
Field Details
-
EMPTY_ELEMENT_ARRAY
-
SUPPRESS_WARNING_PUBLIC_SETTER_STRING
- See Also:
-
MIN_ALLOWED_MESSAGE_KIND_OPTION
Annotation processor option that controls the minimumDiagnostic.Kindof messages emitted by this processor.Some build environments (e.g. Maven with
-Werror) treat compiler notes or warnings as errors. Setting this option toWARNINGorERRORsuppresses informational notes emitted during normal processing.Accepted values (case-insensitive):
NOTE,WARNING,MANDATORY_WARNING,ERROR,OTHER. Defaults toNOTE.- See Also:
-
PLUGIN_CACHE_FILE
The location of the plugin cache data file. This file is written to by this processor, and read from byPluginManager.- See Also:
-
processedElements
-
pluginCache
-
minAllowedMessageKind
-
PLUGIN_BUILDER_ATTRIBUTE_ANNOTATION
- See Also:
-
-
Constructor Details
-
PluginProcessor
public PluginProcessor()
-
-
Method Details
-
init
- Specified by:
initin interfaceProcessor- Overrides:
initin classAbstractProcessor
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersionin interfaceProcessor- Overrides:
getSupportedSourceVersionin classAbstractProcessor
-
printMessage
Prints a message via theMessageronly ifkindis at least as severe as the configuredminimum allowed kind. -
printMessage
Prints a message via theMessageronly ifkindis at least as severe as the configuredminimum allowed kind. -
process
- Specified by:
processin interfaceProcessor- Specified by:
processin classAbstractProcessor
-
processBuilderAttribute
-
processBuilderAttribute
-
expectedFieldNameInASetter
Helper method to get the expected Method name in a field. For example if the field name is 'isopen', then the expected setter would be 'setOpen' or 'withOpen' This method is supposed to return the capitalized 'Open', fieldName which is expected in the setter.- Parameters:
fieldName- who's setter we are checking.- Returns:
- The expected fieldName that will come after withxxxx or setxxxx
-
collectPlugins
-
writeCacheFile
- Throws:
IOException
-