Class BuilderSpec


  • class BuilderSpec
    extends java.lang.Object
    Support for AutoValue builders.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  BuilderSpec.Builder
      Representation of an AutoValue.Builder class or interface.
      static class  BuilderSpec.PropertyGetter
      Information about a builder property getter, referenced from the autovalue.vm template.
      static class  BuilderSpec.PropertySetter
      Information about a property setter, referenced from the autovalue.vm template.
    • Constructor Summary

      Constructors 
      Constructor Description
      BuilderSpec​(javax.lang.model.element.TypeElement autoValueClass, javax.annotation.processing.ProcessingEnvironment processingEnv, ErrorReporter errorReporter)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.Set<javax.lang.model.element.ExecutableElement> abstractMethods​(javax.lang.model.element.TypeElement typeElement)  
      private java.util.Optional<BuilderSpec.Builder> builderFrom​(javax.lang.model.element.TypeElement builderTypeElement)
      Returns a representation of the given @AutoValue.Builder class or interface.
      (package private) java.util.Optional<BuilderSpec.Builder> getBuilder()
      Determines if the @AutoValue class for this instance has a correct nested @AutoValue.Builder class or interface and return a representation of it in an Optional if so.
      private static boolean sameTypeParameters​(javax.lang.model.element.TypeElement a, javax.lang.model.element.TypeElement b)  
      private java.lang.String typeParamsString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • autoValueClass

        private final javax.lang.model.element.TypeElement autoValueClass
      • processingEnv

        private final javax.annotation.processing.ProcessingEnvironment processingEnv
      • CLASS_OR_INTERFACE

        private static final com.google.common.collect.ImmutableSet<javax.lang.model.element.ElementKind> CLASS_OR_INTERFACE
    • Constructor Detail

      • BuilderSpec

        BuilderSpec​(javax.lang.model.element.TypeElement autoValueClass,
                    javax.annotation.processing.ProcessingEnvironment processingEnv,
                    ErrorReporter errorReporter)
    • Method Detail

      • getBuilder

        java.util.Optional<BuilderSpec.Builder> getBuilder()
        Determines if the @AutoValue class for this instance has a correct nested @AutoValue.Builder class or interface and return a representation of it in an Optional if so.
      • builderFrom

        private java.util.Optional<BuilderSpec.Builder> builderFrom​(javax.lang.model.element.TypeElement builderTypeElement)
        Returns a representation of the given @AutoValue.Builder class or interface. If the class or interface has abstract methods that could not be part of any builder, emits error messages and returns Optional.empty().
      • sameTypeParameters

        private static boolean sameTypeParameters​(javax.lang.model.element.TypeElement a,
                                                  javax.lang.model.element.TypeElement b)
      • abstractMethods

        private java.util.Set<javax.lang.model.element.ExecutableElement> abstractMethods​(javax.lang.model.element.TypeElement typeElement)
      • typeParamsString

        private java.lang.String typeParamsString()