Class PropertyBuilderClassifier.PropertyBuilder

java.lang.Object
com.google.auto.value.processor.PropertyBuilderClassifier.PropertyBuilder
Enclosing class:
PropertyBuilderClassifier

public static class PropertyBuilderClassifier.PropertyBuilder extends Object
Information about a property builder, referenced from the autovalue.vm template. A property called bar (defined by a method bar() or getBar()) can have a property builder called barBuilder(). For example, if bar() returns ImmutableSet<String> then barBuilder() might return ImmutableSet.Builder<String>.
  • Field Details

    • propertyBuilderMethod

      private final ExecutableElement propertyBuilderMethod
    • name

      private final String name
    • builderType

      private final String builderType
    • builderTypeMirror

      private final TypeMirror builderTypeMirror
    • initializer

      private final String initializer
    • beforeInitDefault

      private final String beforeInitDefault
    • initDefault

      private final String initDefault
    • builtToBuilder

      private final String builtToBuilder
    • copyAll

      private final String copyAll
  • Constructor Details

  • Method Details

    • getPropertyBuilderMethod

      public ExecutableElement getPropertyBuilderMethod()
      The property builder method, for example barBuilder().
    • getAccess

      public String getAccess()
    • getName

      public String getName()
      The name of the field to hold this builder.
    • getBuilderType

      public String getBuilderType()
      The type of the builder, for example ImmutableSet.Builder<String>.
    • getBuilderTypeMirror

      TypeMirror getBuilderTypeMirror()
    • getInitializer

      public String getInitializer()
      An initializer for the builder field, for example ImmutableSet.builder().
    • getBeforeInitDefault

      public String getBeforeInitDefault()
      An empty string, or a complete statement to be included before the expression returned by getInitDefault().
    • getInitDefault

      public String getInitDefault()
      An expression to return a default instance of the type that this builder builds. For example, if this is an ImmutableList<String> then the method ImmutableList.of() will correctly return an empty ImmutableList<String>, assuming the appropriate context for type inference. The expression here can assume that the statement from getBeforeInitDefault() has preceded it.
    • getBuiltToBuilder

      public String getBuiltToBuilder()
      A method to convert the built type back into a builder. Unfortunately Guava collections don't have this (you can't say myImmutableMap.toBuilder()), but for other types such as @AutoValue types this is toBuilder().
    • getCopyAll

      public String getCopyAll()
      The method to copy another collection into this builder. It is addAll for one-dimensional collections like ImmutableList and ImmutableSet, and it is putAll for two-dimensional collections like ImmutableMap and ImmutableTable.