Package com.google.auto.value.processor
Class AutoOneOfProcessor
java.lang.Object
javax.annotation.processing.AbstractProcessor
com.google.auto.value.processor.AutoValueOrOneOfProcessor
com.google.auto.value.processor.AutoOneOfProcessor
- All Implemented Interfaces:
Processor
@AutoService(javax.annotation.processing.Processor.class)
@SupportedAnnotationTypes("com.google.auto.value.AutoOneOf")
@SupportedOptions("com.google.auto.value.OmitIdentifiers")
public class AutoOneOfProcessor
extends AutoValueOrOneOfProcessor
Javac annotation processor (compiler plugin) for one-of types; user code never references this class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.auto.value.processor.AutoValueOrOneOfProcessor
AutoValueOrOneOfProcessor.ObjectMethod, AutoValueOrOneOfProcessor.Property
-
Field Summary
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
defineVarsForType
(TypeElement type, AutoOneOfTemplateVars vars, com.google.common.collect.ImmutableSet<ExecutableElement> propertyMethods, ExecutableElement kindGetter) private ExecutableElement
findKindGetterOrAbort
(TypeElement autoOneOfType, TypeMirror kindMirror, com.google.common.collect.ImmutableSet<ExecutableElement> abstractMethods) private DeclaredType
mirrorForKindType
(TypeElement autoOneOfType) nullableAnnotationForMethod
(ExecutableElement propertyMethod) Returns the appropriate@Nullable
annotation to put on the implementation of the given property method, and indicates whether the property is in fact nullable.(package private) void
processType
(TypeElement autoOneOfType) Analyzes a single@AutoValue
or@AutoOneOf
class, and outputs the corresponding implementation class or classes.propertyToKindMap
(DeclaredType kindMirror, com.google.common.collect.ImmutableSet<String> propertyNames) private static boolean
sameType
(TypeMirror t1, TypeMirror t2) private String
private void
validateMethods
(TypeElement type, com.google.common.collect.ImmutableSet<ExecutableElement> abstractMethods, com.google.common.collect.ImmutableSet<ExecutableElement> propertyMethods, ExecutableElement kindGetter) Methods inherited from class com.google.auto.value.processor.AutoValueOrOneOfProcessor
abstractMethodsIn, annotationsToCopy, annotationStrings, checkModifiersIfNested, checkReturnType, defineSharedVarsForType, elementUtils, equalsParameterType, errorReporter, fixReservedIdentifiers, generatedClassName, getAnnotationMirror, getSerialVersionUID, getSupportedSourceVersion, hasAnnotationMirror, init, objectMethodToOverride, prefixedGettersIn, process, propertyMethodAnnotationMap, propertyMethodsIn, propertyNameToMethodMap, propertySet, typeUtils, writeSourceFile
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
-
Constructor Details
-
AutoOneOfProcessor
public AutoOneOfProcessor()
-
-
Method Details
-
processType
Description copied from class:AutoValueOrOneOfProcessor
Analyzes a single@AutoValue
or@AutoOneOf
class, and outputs the corresponding implementation class or classes.- Specified by:
processType
in classAutoValueOrOneOfProcessor
- Parameters:
autoOneOfType
- the class with the@AutoValue
or@AutoOneOf
annotation.
-
mirrorForKindType
-
propertyToKindMap
private com.google.common.collect.ImmutableMap<String,String> propertyToKindMap(DeclaredType kindMirror, com.google.common.collect.ImmutableSet<String> propertyNames) -
transformName
-
findKindGetterOrAbort
private ExecutableElement findKindGetterOrAbort(TypeElement autoOneOfType, TypeMirror kindMirror, com.google.common.collect.ImmutableSet<ExecutableElement> abstractMethods) -
validateMethods
private void validateMethods(TypeElement type, com.google.common.collect.ImmutableSet<ExecutableElement> abstractMethods, com.google.common.collect.ImmutableSet<ExecutableElement> propertyMethods, ExecutableElement kindGetter) -
defineVarsForType
private void defineVarsForType(TypeElement type, AutoOneOfTemplateVars vars, com.google.common.collect.ImmutableSet<ExecutableElement> propertyMethods, ExecutableElement kindGetter) -
nullableAnnotationForMethod
Description copied from class:AutoValueOrOneOfProcessor
Returns the appropriate@Nullable
annotation to put on the implementation of the given property method, and indicates whether the property is in fact nullable. The annotation in question is on the method, not its return type. If instead the return type is@Nullable
, this method returnsOptional.of("")
, to indicate that the property is nullable but the method isn't. The@Nullable
annotation will instead appear when the return type of the method is spelled out in the implementation.- Specified by:
nullableAnnotationForMethod
in classAutoValueOrOneOfProcessor
-
sameType
-