@NotThreadSafe public static final class ImmutableInstanceField.Builder extends Object
ImmutableInstanceField.
Initialize attributes and then invoke build() method to create
immutable instance.
Builder is not thread safe and generally should not be stored in field or collection,
but used immediately to create instances.
| Modifier and Type | Method and Description |
|---|---|
ImmutableInstanceField |
build()
Builds new
ImmutableInstanceField. |
ImmutableInstanceField.Builder |
codecForClass(com.squareup.javapoet.TypeName codecForClass)
Initializes value for
codecForClass. |
ImmutableInstanceField.Builder |
customCodec(boolean customCodec)
Initializes value for
customCodec. |
ImmutableInstanceField.Builder |
from(InstanceField instance)
Fill builder with attribute values from provided
InstanceField instance. |
ImmutableInstanceField.Builder |
name(String name)
Initializes value for
name. |
ImmutableInstanceField.Builder |
type(com.squareup.javapoet.TypeName type)
Initializes value for
type. |
public final ImmutableInstanceField.Builder from(InstanceField instance)
InstanceField instance.
Regular attribute values will be replaced with ones of an instance.
Instance's absent optional values will not replace present values.instance - instance to copy values fromthis builder for chained invocationpublic final ImmutableInstanceField.Builder type(com.squareup.javapoet.TypeName type)
type.type - value for typethis builder for chained invocationpublic final ImmutableInstanceField.Builder name(String name)
name.name - value for namethis builder for chained invocationpublic final ImmutableInstanceField.Builder codecForClass(@Nullable com.squareup.javapoet.TypeName codecForClass)
codecForClass.codecForClass - value for codecForClass, can be nullthis builder for chained invocationpublic final ImmutableInstanceField.Builder customCodec(boolean customCodec)
customCodec.
If not set, this attribute will have default value returned by initializer of customCodec.
customCodec - value for customCodecthis builder for chained invocationpublic ImmutableInstanceField build() throws IllegalStateException
ImmutableInstanceField.exception - java.lang.IllegalStateException if any required attributes are missingIllegalStateExceptionCopyright © 2015. All rights reserved.