Class GraalVmProcessor
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- org.apache.logging.log4j.core.config.plugins.processor.GraalVmProcessor
-
- All Implemented Interfaces:
javax.annotation.processing.Processor
@SupportedAnnotationTypes({"org.apache.logging.log4j.core.config.plugins.validation.Constraint","org.apache.logging.log4j.core.config.plugins.Plugin","org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute","org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory","org.apache.logging.log4j.core.config.plugins.PluginConfiguration","org.apache.logging.log4j.core.config.plugins.PluginElement","org.apache.logging.log4j.core.config.plugins.PluginFactory","org.apache.logging.log4j.core.config.plugins.PluginLoggerContext","org.apache.logging.log4j.core.config.plugins.PluginNode","org.apache.logging.log4j.core.config.plugins.PluginValue","org.apache.logging.log4j.core.config.plugins.PluginVisitorStrategy"}) @SupportedOptions({"log4j.graalvm.groupId","log4j.graalvm.artifactId"}) public class GraalVmProcessor extends javax.annotation.processing.AbstractProcessorJava annotation processor that generates GraalVM metadata.Note: The annotations listed here must also be classified by the
Annotationshelper.
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationsannotationUtil(package private) static java.lang.StringARTIFACT_ID(package private) static java.lang.StringGROUP_IDprivate static java.lang.StringLOCATION_PREFIXprivate static java.lang.StringLOCATION_SUFFIXprivate java.util.List<javax.lang.model.element.Element>processedElementsprivate static java.lang.StringPROCESSOR_NAMEprivate java.util.Map<java.lang.String,ReachabilityMetadata.Type>reachableTypes
-
Constructor Summary
Constructors Constructor Description GraalVmProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddField(javax.lang.model.element.TypeElement parent, javax.lang.model.element.VariableElement element)private voidaddMethod(javax.lang.model.element.TypeElement parent, javax.lang.model.element.ExecutableElement element)(package private) java.lang.StringgetReachabilityMetadataPath(@Nullable java.lang.String groupId, @Nullable java.lang.String artifactId, java.lang.String fallbackFolderName)Returns the path to the reachability metadata file.javax.lang.model.SourceVersiongetSupportedSourceVersion()voidinit(javax.annotation.processing.ProcessingEnvironment processingEnv)booleanprocess(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)private voidprocessConstraintOrVisitor(javax.lang.model.element.Element element, javax.lang.model.element.TypeElement annotation)private voidprocessFactory(javax.lang.model.element.Element element)private voidprocessParameter(javax.lang.model.element.Element element)private voidprocessPlugin(javax.lang.model.element.Element element)private <T extends javax.lang.model.element.Element>
TsafeCast(javax.lang.model.element.Element element, java.lang.Class<T> type)private java.lang.StringtoString(javax.lang.model.element.TypeElement element)Returns the fully qualified name of the element corresponding to aDeclaredType.private java.lang.StringtoString(javax.lang.model.type.TypeMirror type)Returns the fully qualified name of a type.private voidwriteReachabilityMetadata()
-
-
-
Field Detail
-
GROUP_ID
static final java.lang.String GROUP_ID
- See Also:
- Constant Field Values
-
ARTIFACT_ID
static final java.lang.String ARTIFACT_ID
- See Also:
- Constant Field Values
-
LOCATION_PREFIX
private static final java.lang.String LOCATION_PREFIX
- See Also:
- Constant Field Values
-
LOCATION_SUFFIX
private static final java.lang.String LOCATION_SUFFIX
- See Also:
- Constant Field Values
-
PROCESSOR_NAME
private static final java.lang.String PROCESSOR_NAME
-
reachableTypes
private final java.util.Map<java.lang.String,ReachabilityMetadata.Type> reachableTypes
-
processedElements
private final java.util.List<javax.lang.model.element.Element> processedElements
-
annotationUtil
private Annotations annotationUtil
-
-
Method Detail
-
init
public void init(javax.annotation.processing.ProcessingEnvironment processingEnv)
- Specified by:
initin interfacejavax.annotation.processing.Processor- Overrides:
initin classjavax.annotation.processing.AbstractProcessor
-
getSupportedSourceVersion
public javax.lang.model.SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersionin interfacejavax.annotation.processing.Processor- Overrides:
getSupportedSourceVersionin classjavax.annotation.processing.AbstractProcessor
-
process
public boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)- Specified by:
processin interfacejavax.annotation.processing.Processor- Specified by:
processin classjavax.annotation.processing.AbstractProcessor
-
processPlugin
private void processPlugin(javax.lang.model.element.Element element)
-
processConstraintOrVisitor
private void processConstraintOrVisitor(javax.lang.model.element.Element element, javax.lang.model.element.TypeElement annotation)
-
processParameter
private void processParameter(javax.lang.model.element.Element element)
-
processFactory
private void processFactory(javax.lang.model.element.Element element)
-
writeReachabilityMetadata
private void writeReachabilityMetadata()
-
getReachabilityMetadataPath
java.lang.String getReachabilityMetadataPath(@Nullable java.lang.String groupId, @Nullable java.lang.String artifactId, java.lang.String fallbackFolderName)Returns the path to the reachability metadata file.If the groupId or artifactId is not specified, a warning is printed and a fallback folder name is used. The fallback folder name should be reproducible, but unique enough to avoid conflicts.
- Parameters:
groupId- The group ID of the plugin.artifactId- The artifact ID of the plugin.fallbackFolderName- The fallback folder name to use if groupId or artifactId is not specified.
-
addField
private void addField(javax.lang.model.element.TypeElement parent, javax.lang.model.element.VariableElement element)
-
addMethod
private void addMethod(javax.lang.model.element.TypeElement parent, javax.lang.model.element.ExecutableElement element)
-
safeCast
private <T extends javax.lang.model.element.Element> T safeCast(javax.lang.model.element.Element element, java.lang.Class<T> type)
-
toString
private java.lang.String toString(javax.lang.model.type.TypeMirror type)
Returns the fully qualified name of a type.- Parameters:
type- A Java type.
-
toString
private java.lang.String toString(javax.lang.model.element.TypeElement element)
Returns the fully qualified name of the element corresponding to aDeclaredType.- Parameters:
element- A Java language element.
-
-