Class 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
    • Constructor Detail

      • AutoOneOfProcessor

        public AutoOneOfProcessor()
    • Method Detail

      • processType

        void processType​(javax.lang.model.element.TypeElement autoOneOfType)
        Description copied from class: AutoValueOrOneOfProcessor
        Analyzes a single @AutoValue or @AutoOneOf class, and outputs the corresponding implementation class or classes.
        Specified by:
        processType in class AutoValueOrOneOfProcessor
        Parameters:
        autoOneOfType - the class with the @AutoValue or @AutoOneOf annotation.
      • 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: 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 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.
        Specified by:
        nullableAnnotationForMethod in class AutoValueOrOneOfProcessor
      • sameType

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