@NotThreadSafe public static final class ImmutableInstanceField.Builder extends Object
ImmutableInstanceField.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
| Modifier and Type | Method and Description |
|---|---|
ImmutableInstanceField |
build()
Builds a new
ImmutableInstanceField. |
ImmutableInstanceField.Builder |
codecForClass(com.squareup.javapoet.TypeName codecForClass)
Initializes the value for the
codecForClass attribute. |
ImmutableInstanceField.Builder |
customCodec(boolean customCodec)
Initializes the value for the
customCodec attribute. |
ImmutableInstanceField.Builder |
from(InstanceField instance)
Fill a builder with attribute values from the provided
InstanceField instance. |
ImmutableInstanceField.Builder |
name(String name)
Initializes the value for the
name attribute. |
ImmutableInstanceField.Builder |
type(com.squareup.javapoet.TypeName type)
Initializes the value for the
type attribute. |
public final ImmutableInstanceField.Builder from(InstanceField instance)
InstanceField instance.
Regular attribute values will be replaced with those from the given instance.
Absent optional values will not replace present values.instance - The instance from which to copy valuesthis builder for use in a chained invocationpublic final ImmutableInstanceField.Builder type(com.squareup.javapoet.TypeName type)
type attribute.type - The value for typethis builder for use in a chained invocationpublic final ImmutableInstanceField.Builder name(String name)
name attribute.name - The value for namethis builder for use in a chained invocationpublic final ImmutableInstanceField.Builder codecForClass(@Nullable com.squareup.javapoet.TypeName codecForClass)
codecForClass attribute.codecForClass - The value for codecForClass (can be null)this builder for use in a chained invocationpublic final ImmutableInstanceField.Builder customCodec(boolean customCodec)
customCodec attribute.
If not set, this attribute will have a default value as returned by the initializer of customCodec.
customCodec - The value for customCodecthis builder for use in a chained invocationpublic ImmutableInstanceField build()
ImmutableInstanceField.IllegalStateException - if any required attributes are missingCopyright © 2015–2016. All rights reserved.