Top Description Constructors Methods
com.google.auto.value.processor

public Class AutoOneOfProcessor

extends AutoValueishProcessor
Class Inheritance
Annotations
@AutoService:javax.annotation.processing.Processor
@javax.annotation.processing.SupportedAnnotationTypes
@IncrementalAnnotationProcessor:ISOLATING
Static Imports
com.google.auto.common.MoreElements.getLocalAndInheritedMethods, com.google.auto.value.processor.ClassNames.AUTO_ONE_OF_NAME, java.util.stream.Collectors.toMap, .Collectors.toSet

Javac annotation processor (compiler plugin) for one-of types; user code never references this class.
Author
Éamonn McManus
See Also
AutoValue User's Guide

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
defineVarsForType(javax.lang.model.element.TypeElement type, AutoOneOfTemplateVars vars, ImmutableMap<javax.lang.model.element.ExecutableElement, javax.lang.model.type.TypeMirror> propertyMethodsAndTypes, javax.lang.model.element.ExecutableElement kindGetter, Nullables nullables)

private javax.lang.model.element.ExecutableElement
findKindGetterOrAbort(javax.lang.model.element.TypeElement autoOneOfType, javax.lang.model.type.TypeMirror kindMirror, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods)

public ImmutableSet<String>
private javax.lang.model.type.DeclaredType
mirrorForKindType(javax.lang.model.element.TypeElement autoOneOfType)

pack-priv Optional<String>
nullableAnnotationForMethod(javax.lang.model.element.ExecutableElement propertyMethod)

Implements abstract com.google.auto.value.processor.AutoValueishProcessor.nullableAnnotationForMethod.

Returns the appropriate @Nullable annotation to put on the implementation of the given property method, and indicates whether the property is in fact nullable.

pack-priv void
processType(javax.lang.model.element.TypeElement
the class with the @AutoValue or @AutoOneOf annotation.
autoOneOfType
)

Implements abstract com.google.auto.value.processor.AutoValueishProcessor.processType.

Analyzes a single @AutoValue (etc) class, and outputs the corresponding implementation class or classes.

pack-priv boolean
private ImmutableMap<String, String>
propertyToKindMap(javax.lang.model.type.DeclaredType kindMirror, ImmutableSet<String> propertyNames)

private static boolean
sameType(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)

private String
private void
validateMethods(javax.lang.model.element.TypeElement type, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.ExecutableElement kindGetter)

Inherited from com.google.auto.value.processor.AutoValueishProcessor:
abstractMethodsInaddDeferredTypeannotationsToCopyannotationStringscheckModifiersIfNestedcheckModifiersIfNestedcheckReturnTypecopiedClassAnnotationscopyAnnotationsdeferredTypeNamesdefineSharedVarsForTypeelementUtilsequalsParameterTypeerrorReporterfixReservedIdentifiersgeneratedClassNamegetAnnotationMirrorgetAnnotationsMarkedWithInheritedgetExcludedAnnotationClassNamesgetSerialVersionUIDgetSupportedSourceVersionhasAnnotationMirrorhasVisibleNoArgConstructorinitisPrefixedGetternameWithoutPrefixnullableAnnotationForobjectMethodToOverrideprefixedGettersInprocesspropertyFieldAnnotationMappropertyMethodAnnotationMappropertyMethodAnnotationspropertyMethodsInpropertyNameToMethodMappropertySettypeUtilswriteSourceFile

Constructor Detail

AutoOneOfProcessorback to summary
public AutoOneOfProcessor()

Method Detail

defineVarsForTypeback to summary
private void defineVarsForType(javax.lang.model.element.TypeElement type, AutoOneOfTemplateVars vars, ImmutableMap<javax.lang.model.element.ExecutableElement, javax.lang.model.type.TypeMirror> propertyMethodsAndTypes, javax.lang.model.element.ExecutableElement kindGetter, Nullables nullables)
findKindGetterOrAbortback to summary
private javax.lang.model.element.ExecutableElement findKindGetterOrAbort(javax.lang.model.element.TypeElement autoOneOfType, javax.lang.model.type.TypeMirror kindMirror, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods)
getSupportedOptionsback to summary
public ImmutableSet<String> getSupportedOptions()
Annotations
@Override
mirrorForKindTypeback to summary
private javax.lang.model.type.DeclaredType mirrorForKindType(javax.lang.model.element.TypeElement autoOneOfType)
nullableAnnotationForMethodback to summary
pack-priv Optional<String> nullableAnnotationForMethod(javax.lang.model.element.ExecutableElement propertyMethod)

Implements abstract com.google.auto.value.processor.AutoValueishProcessor.nullableAnnotationForMethod.

Doc from com.google.auto.value.processor.AutoValueishProcessor.nullableAnnotationForMethod.

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 returns Optional.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.

Annotations
@Override
processTypeback to summary
pack-priv void processType(javax.lang.model.element.TypeElement autoOneOfType)

Implements abstract com.google.auto.value.processor.AutoValueishProcessor.processType.

Doc from com.google.auto.value.processor.AutoValueishProcessor.processType.

Analyzes a single @AutoValue (etc) class, and outputs the corresponding implementation class or classes.

Parameters
autoOneOfType:javax.lang.model.element.TypeElement

the class with the @AutoValue or @AutoOneOf annotation.

Annotations
@Override
propertiesCanBeVoidback to summary
pack-priv boolean propertiesCanBeVoid()

Overrides com.google.auto.value.processor.AutoValueishProcessor.propertiesCanBeVoid.

Doc from com.google.auto.value.processor.AutoValueishProcessor.propertiesCanBeVoid.

True if void properties are allowed.

Annotations
@Override
propertyToKindMapback to summary
private ImmutableMap<String, String> propertyToKindMap(javax.lang.model.type.DeclaredType kindMirror, ImmutableSet<String> propertyNames)
sameTypeback to summary
private static boolean sameType(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)
transformNameback to summary
private String transformName(String s)
validateMethodsback to summary
private void validateMethods(javax.lang.model.element.TypeElement type, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, javax.lang.model.element.ExecutableElement kindGetter)