Class BuilderSpec.Builder

  • Enclosing class:
    BuilderSpec

    class BuilderSpec.Builder
    extends java.lang.Object
    Representation of an AutoValue.Builder class or interface.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.lang.model.element.TypeElement builderTypeElement  
      private com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods  
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder​(javax.lang.model.element.TypeElement builderTypeElement)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void defineVars​(AutoValueTemplateVars vars, com.google.common.collect.ImmutableBiMap<javax.lang.model.element.ExecutableElement,​java.lang.String> getterToPropertyName)  
      (package private) com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods​(javax.lang.model.util.Types typeUtils, java.util.Set<javax.lang.model.element.ExecutableElement> abstractMethods)
      Finds any methods in the set that return the builder type.
      • Methods inherited from class java.lang.Object

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

      • builderTypeElement

        private final javax.lang.model.element.TypeElement builderTypeElement
      • toBuilderMethods

        private com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods
    • Constructor Detail

      • Builder

        Builder​(javax.lang.model.element.TypeElement builderTypeElement)
    • Method Detail

      • toBuilderMethods

        com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> toBuilderMethods​(javax.lang.model.util.Types typeUtils,
                                                                                                            java.util.Set<javax.lang.model.element.ExecutableElement> abstractMethods)
        Finds any methods in the set that return the builder type. If the builder has type parameters <A, B>, then the return type of the method must be Builder<A, B> with the same parameter names. We enforce elsewhere that the names and bounds of the builder parameters must be the same as those of the @AutoValue class. Here's a correct example:
         @AutoValue abstract class Foo<A extends Number, B> {
           abstract int someProperty();
        
           abstract Builder<A, B> toBuilder();
        
           interface Builder<A extends Number, B> {...}
         }
         

        We currently impose that there cannot be more than one such method.

      • defineVars

        void defineVars​(AutoValueTemplateVars vars,
                        com.google.common.collect.ImmutableBiMap<javax.lang.model.element.ExecutableElement,​java.lang.String> getterToPropertyName)