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:
javax.annotation.processing.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:
- AutoValue User's Guide
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.auto.value.processor.AutoValueOrOneOfProcessor
AutoValueOrOneOfProcessor.ObjectMethod, AutoValueOrOneOfProcessor.Property
-
-
Constructor Summary
Constructors Constructor Description AutoOneOfProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddefineVarsForType(javax.lang.model.element.TypeElement type, AutoOneOfTemplateVars vars, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.ExecutableElement kindGetter)private javax.lang.model.element.ExecutableElementfindKindGetterOrAbort(javax.lang.model.element.TypeElement autoOneOfType, javax.lang.model.type.TypeMirror kindMirror, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods)private javax.lang.model.type.DeclaredTypemirrorForKindType(javax.lang.model.element.TypeElement autoOneOfType)(package private) java.util.Optional<java.lang.String>nullableAnnotationForMethod(javax.lang.model.element.ExecutableElement propertyMethod)Returns the appropriate@Nullableannotation to put on the implementation of the given property method, and indicates whether the property is in fact nullable.(package private) voidprocessType(javax.lang.model.element.TypeElement autoOneOfType)Analyzes a single@AutoValueor@AutoOneOfclass, and outputs the corresponding implementation class or classes.private com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>propertyToKindMap(javax.lang.model.type.DeclaredType kindMirror, com.google.common.collect.ImmutableSet<java.lang.String> propertyNames)private static booleansameType(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)private java.lang.StringtransformName(java.lang.String s)private voidvalidateMethods(javax.lang.model.element.TypeElement type, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.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
-
-
-
-
Method Detail
-
processType
void processType(javax.lang.model.element.TypeElement autoOneOfType)
Description copied from class:AutoValueOrOneOfProcessorAnalyzes a single@AutoValueor@AutoOneOfclass, and outputs the corresponding implementation class or classes.- Specified by:
processTypein classAutoValueOrOneOfProcessor- Parameters:
autoOneOfType- the class with the@AutoValueor@AutoOneOfannotation.
-
mirrorForKindType
private javax.lang.model.type.DeclaredType mirrorForKindType(javax.lang.model.element.TypeElement autoOneOfType)
-
propertyToKindMap
private com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> propertyToKindMap(javax.lang.model.type.DeclaredType kindMirror, com.google.common.collect.ImmutableSet<java.lang.String> propertyNames)
-
transformName
private java.lang.String transformName(java.lang.String s)
-
findKindGetterOrAbort
private javax.lang.model.element.ExecutableElement findKindGetterOrAbort(javax.lang.model.element.TypeElement autoOneOfType, javax.lang.model.type.TypeMirror kindMirror, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods)
-
validateMethods
private void validateMethods(javax.lang.model.element.TypeElement type, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.ExecutableElement kindGetter)
-
defineVarsForType
private void defineVarsForType(javax.lang.model.element.TypeElement type, AutoOneOfTemplateVars vars, com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.ExecutableElement kindGetter)
-
nullableAnnotationForMethod
java.util.Optional<java.lang.String> nullableAnnotationForMethod(javax.lang.model.element.ExecutableElement propertyMethod)
Description copied from class:AutoValueOrOneOfProcessorReturns the appropriate@Nullableannotation 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@Nullableannotation will instead appear when the return type of the method is spelled out in the implementation.- Specified by:
nullableAnnotationForMethodin classAutoValueOrOneOfProcessor
-
sameType
private static boolean sameType(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)
-
-