Package com.google.auto.value.processor
Class PropertyBuilderClassifier.PropertyBuilder
java.lang.Object
com.google.auto.value.processor.PropertyBuilderClassifier.PropertyBuilder
- Enclosing class:
PropertyBuilderClassifier
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final String
private final TypeMirror
private final String
private final String
private final String
private final String
private final String
private final ExecutableElement
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyBuilder
(ExecutableElement propertyBuilderMethod, String builderType, TypeMirror builderTypeMirror, String initializer, String beforeInitDefault, String initDefault, String builtToBuilder, String copyAll) -
Method Summary
Modifier and TypeMethodDescriptionAn empty string, or a complete statement to be included before the expression returned bygetInitDefault()
.The type of the builder, for exampleImmutableSet.Builder<String>
.(package private) TypeMirror
A method to convert the built type back into a builder.The method to copy another collection into this builder.An expression to return a default instance of the type that this builder builds.An initializer for the builder field, for exampleImmutableSet.builder()
.getName()
The name of the field to hold this builder.The property builder method, for examplebarBuilder()
.
-
Field Details
-
propertyBuilderMethod
-
name
-
builderType
-
builderTypeMirror
-
initializer
-
beforeInitDefault
-
initDefault
-
builtToBuilder
-
copyAll
-
-
Constructor Details
-
PropertyBuilder
PropertyBuilder(ExecutableElement propertyBuilderMethod, String builderType, TypeMirror builderTypeMirror, String initializer, String beforeInitDefault, String initDefault, String builtToBuilder, String copyAll)
-
-
Method Details
-
getPropertyBuilderMethod
The property builder method, for examplebarBuilder()
. -
getAccess
-
getName
The name of the field to hold this builder. -
getBuilderType
The type of the builder, for exampleImmutableSet.Builder<String>
. -
getBuilderTypeMirror
TypeMirror getBuilderTypeMirror() -
getInitializer
An initializer for the builder field, for exampleImmutableSet.builder()
. -
getBeforeInitDefault
An empty string, or a complete statement to be included before the expression returned bygetInitDefault()
. -
getInitDefault
An expression to return a default instance of the type that this builder builds. For example, if this is anImmutableList<String>
then the methodImmutableList.of()
will correctly return an emptyImmutableList<String>
, assuming the appropriate context for type inference. The expression here can assume that the statement fromgetBeforeInitDefault()
has preceded it. -
getBuiltToBuilder
A method to convert the built type back into a builder. Unfortunately Guava collections don't have this (you can't saymyImmutableMap.toBuilder()
), but for other types such as@AutoValue
types this istoBuilder()
. -
getCopyAll
The method to copy another collection into this builder. It isaddAll
for one-dimensional collections likeImmutableList
andImmutableSet
, and it isputAll
for two-dimensional collections likeImmutableMap
andImmutableTable
.
-