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

public Class AutoValueProcessor

extends AutoValueishProcessor
Class Inheritance
Annotations
@AutoService:javax.annotation.processing.Processor
@javax.annotation.processing.SupportedAnnotationTypes
@IncrementalAnnotationProcessor:DYNAMIC
Static Imports
com.google.auto.common.MoreElements.getLocalAndInheritedMethods, .MoreStreams.toImmutableList, com.google.auto.value.processor.ClassNames.AUTO_VALUE_NAME, com.google.common.base.Preconditions.checkState, com.google.common.collect.Sets.difference, .Sets.intersection, java.util.Comparator.naturalOrder, java.util.stream.Collectors.joining

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

Field Summary

Modifier and TypeField and Description
private ImmutableList<AutoValueExtension>
private final ClassLoader
private static final String
pack-priv static final String

Constructor Summary

AccessConstructor and Description
public
pack-priv
AutoValueProcessor(ClassLoader loaderForExtensions)

public
AutoValueProcessor(Iterable<? extends AutoValueExtension> testExtensions)

private
AutoValueProcessor(Iterable<? extends AutoValueExtension> testExtensions, ClassLoader loaderForExtensions)

Method Summary

Modifier and TypeMethod and Description
private boolean
ancestorIsAutoValue(javax.lang.model.element.TypeElement type)

private ImmutableList<AutoValueExtension>
applicableExtensions(javax.lang.model.element.TypeElement type, ExtensionContext context)

private void
defineVarsForType(javax.lang.model.element.TypeElement type, AutoValueTemplateVars vars, ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods, ImmutableMap<javax.lang.model.element.ExecutableElement, javax.lang.model.type.TypeMirror> propertyMethodsAndTypes, Optional<BuilderSpec.Builder> maybeBuilder, Nullables nullables)

private String
pack-priv static ImmutableList<AutoValueExtension>
pack-priv static String
generatedSubclassName(javax.lang.model.element.TypeElement type, int depth)

public ImmutableSet<String>
private javax.lang.model.type.TypeMirror
private static <E> ImmutableSet<E>
private boolean
implementsAnnotation(javax.lang.model.element.TypeElement type)

public synchronized void
init(javax.annotation.processing.ProcessingEnvironment processingEnv)

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

private ImmutableSet<javax.lang.model.element.ExecutableElement>
methodsConsumedByExtensions(javax.lang.model.element.TypeElement type, ImmutableList<AutoValueExtension> applicableExtensions, ExtensionContext context, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, ImmutableMap<String, javax.lang.model.element.ExecutableElement> properties)

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.

private static ImmutableSet<String>
pack-priv static ImmutableSet<javax.lang.model.element.ExecutableElement>
prefixedGettersIn(Iterable<javax.lang.model.element.ExecutableElement> methods)

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

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

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

private void
validateMethods(javax.lang.model.element.TypeElement type, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods, ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, boolean extensionsPresent)

private int
writeExtensions(javax.lang.model.element.TypeElement type, ExtensionContext context, ImmutableList<AutoValueExtension> applicableExtensions)

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

Field Detail

extensionsback to summary
private ImmutableList<AutoValueExtension> extensions
loaderForExtensionsback to summary
private final ClassLoader loaderForExtensions
OLD_MEMOIZE_EXTENSIONback to summary
private static final String OLD_MEMOIZE_EXTENSION
OMIT_IDENTIFIERS_OPTIONback to summary
pack-priv static final String OMIT_IDENTIFIERS_OPTION

Constructor Detail

AutoValueProcessorback to summary
public AutoValueProcessor()
AutoValueProcessorback to summary
pack-priv AutoValueProcessor(ClassLoader loaderForExtensions)
Annotations
@VisibleForTesting
AutoValueProcessorback to summary
public AutoValueProcessor(Iterable<? extends AutoValueExtension> testExtensions)
Annotations
@VisibleForTesting
AutoValueProcessorback to summary
private AutoValueProcessor(Iterable<? extends AutoValueExtension> testExtensions, ClassLoader loaderForExtensions)

Method Detail

ancestorIsAutoValueback to summary
private boolean ancestorIsAutoValue(javax.lang.model.element.TypeElement type)
applicableExtensionsback to summary
private ImmutableList<AutoValueExtension> applicableExtensions(javax.lang.model.element.TypeElement type, ExtensionContext context)
defineVarsForTypeback to summary
private void defineVarsForType(javax.lang.model.element.TypeElement type, AutoValueTemplateVars vars, ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods, ImmutableMap<javax.lang.model.element.ExecutableElement, javax.lang.model.type.TypeMirror> propertyMethodsAndTypes, Optional<BuilderSpec.Builder> maybeBuilder, Nullables nullables)
extensionNameback to summary
private String extensionName(AutoValueExtension extension)
extensionsFromLoaderback to summary
pack-priv static ImmutableList<AutoValueExtension> extensionsFromLoader(ClassLoader loader)
Annotations
@VisibleForTesting
generatedSubclassNameback to summary
pack-priv static String generatedSubclassName(javax.lang.model.element.TypeElement type, int depth)
getSupportedOptionsback to summary
public ImmutableSet<String> getSupportedOptions()
Annotations
@Override
getTypeMirrorback to summary
private javax.lang.model.type.TypeMirror getTypeMirror(Class<?> c)
immutableSetDifferenceback to summary
private static <E> ImmutableSet<E> immutableSetDifference(ImmutableSet<E> a, ImmutableSet<E> b)
implementsAnnotationback to summary
private boolean implementsAnnotation(javax.lang.model.element.TypeElement type)
initback to summary
public synchronized void init(javax.annotation.processing.ProcessingEnvironment processingEnv)

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

Annotations
@Override
methodsConsumedByExtensionsback to summary
private ImmutableSet<javax.lang.model.element.ExecutableElement> methodsConsumedByExtensions(javax.lang.model.element.TypeElement type, ImmutableList<AutoValueExtension> applicableExtensions, ExtensionContext context, ImmutableSet<javax.lang.model.element.ExecutableElement> abstractMethods, ImmutableMap<String, javax.lang.model.element.ExecutableElement> properties)
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
optionsForback to summary
private static ImmutableSet<String> optionsFor(AutoValueExtension.IncrementalExtensionType incrementalType)
prefixedGettersInback to summary
pack-priv static ImmutableSet<javax.lang.model.element.ExecutableElement> prefixedGettersIn(Iterable<javax.lang.model.element.ExecutableElement> methods)
processTypeback to summary
pack-priv void processType(javax.lang.model.element.TypeElement type)

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
type:javax.lang.model.element.TypeElement

the class with the @AutoValue or @AutoOneOf annotation.

Annotations
@Override
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> toBuilderMethods, ImmutableSet<javax.lang.model.element.ExecutableElement> propertyMethods, boolean extensionsPresent)
writeExtensionsback to summary
private int writeExtensions(javax.lang.model.element.TypeElement type, ExtensionContext context, ImmutableList<AutoValueExtension> applicableExtensions)