Class ImmutableEncodingInfo.Builder
java.lang.Object
org.immutables.value.processor.encode.ImmutableEncodingInfo.Builder
- Direct Known Subclasses:
EncodingInfo.Builder
- Enclosing class:
ImmutableEncodingInfo
Builds instances of type
EncodingInfo.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.ImmutableList.Builder<EncodedElement> private final com.google.common.collect.ImmutableSet.Builder<String> private static final longprivate static final longprivate static final longprivate longprivate Stringprivate Type.Factoryprivate Type.Parameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal EncodingInfo.BuilderaddAllElement(Iterable<? extends EncodedElement> elements) Adds elements toelementlist.final EncodingInfo.BuilderaddAllImports(Iterable<String> elements) Adds elements toimportsset.final EncodingInfo.BuilderaddElement(EncodedElement element) Adds one element toelementlist.final EncodingInfo.BuilderaddElement(EncodedElement... elements) Adds elements toelementlist.final EncodingInfo.BuilderaddImports(String element) Adds one element toimportsset.final EncodingInfo.BuilderaddImports(String... elements) Adds elements toimportsset.build()Builds a newEncodingInfo.private static voidcheckNotIsSet(boolean isSet, String name) private voidprivate Stringfinal EncodingInfo.BuilderInitializes the value for thenameattribute.private booleanfinal EncodingInfo.BuildertypeFactory(Type.Factory typeFactory) Initializes the value for thetypeFactoryattribute.private booleanfinal EncodingInfo.BuildertypeParameters(Type.Parameters typeParameters) Initializes the value for thetypeParametersattribute.private boolean
-
Field Details
-
INIT_BIT_NAME
private static final long INIT_BIT_NAME- See Also:
-
INIT_BIT_TYPE_PARAMETERS
private static final long INIT_BIT_TYPE_PARAMETERS- See Also:
-
INIT_BIT_TYPE_FACTORY
private static final long INIT_BIT_TYPE_FACTORY- See Also:
-
initBits
private long initBits -
name
-
imports
-
typeParameters
-
typeFactory
-
element
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forEncodingInfoinstances.new EncodingInfo.Builder() .name(String) // requiredname.addImports|addAllImports(String) //importselements .typeParameters(org.immutables.value.processor.encode.Type.Parameters) // requiredtypeParameters.typeFactory(org.immutables.value.processor.encode.Type.Factory) // requiredtypeFactory.addElement|addAllElement(org.immutables.value.processor.encode.EncodedElement) //elementelements .build();
-
-
Method Details
-
name
Initializes the value for thenameattribute.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
addImports
Adds one element toimportsset.- Parameters:
element- A imports element- Returns:
thisbuilder for use in a chained invocation
-
addImports
Adds elements toimportsset.- Parameters:
elements- An array of imports elements- Returns:
thisbuilder for use in a chained invocation
-
addAllImports
Adds elements toimportsset.- Parameters:
elements- An iterable of imports elements- Returns:
thisbuilder for use in a chained invocation
-
typeParameters
Initializes the value for thetypeParametersattribute.- Parameters:
typeParameters- The value for typeParameters- Returns:
thisbuilder for use in a chained invocation
-
typeFactory
Initializes the value for thetypeFactoryattribute.- Parameters:
typeFactory- The value for typeFactory- Returns:
thisbuilder for use in a chained invocation
-
addElement
Adds one element toelementlist.- Parameters:
element- A element element- Returns:
thisbuilder for use in a chained invocation
-
addElement
Adds elements toelementlist.- Parameters:
elements- An array of element elements- Returns:
thisbuilder for use in a chained invocation
-
addAllElement
Adds elements toelementlist.- Parameters:
elements- An iterable of element elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newEncodingInfo.- Returns:
- An immutable instance of EncodingInfo
- Throws:
IllegalStateException- if any required attributes are missing
-
nameIsSet
private boolean nameIsSet() -
typeParametersIsSet
private boolean typeParametersIsSet() -
typeFactoryIsSet
private boolean typeFactoryIsSet() -
checkNotIsSet
-
checkRequiredAttributes
private void checkRequiredAttributes() -
formatRequiredAttributesMessage
-