java.lang.Object
io.resys.hdes.client.api.programs.ImmutableProgramWrapper.Builder<A,P>
- Enclosing class:
- ImmutableProgramWrapper<A extends AstBody,
P extends Program>
@NotThreadSafe
public static final class ImmutableProgramWrapper.Builder<A extends AstBody,P extends Program>
extends Object
Builds instances of type
ImmutableProgramWrapper.
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.
-
Method Summary
Modifier and TypeMethodDescriptionfinal ImmutableProgramWrapper.Builder<A,P> addAllAssociations(Iterable<? extends ProgramEnvir.ProgramAssociation> elements) Adds elements toassociationslist.final ImmutableProgramWrapper.Builder<A,P> addAllErrors(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Adds elements toerrorslist.final ImmutableProgramWrapper.Builder<A,P> addAllHeaders(Iterable<? extends TypeDef> elements) Adds elements toheaderslist.final ImmutableProgramWrapper.Builder<A,P> addAllWarnings(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Adds elements towarningslist.final ImmutableProgramWrapper.Builder<A,P> Adds one element toassociationslist.final ImmutableProgramWrapper.Builder<A,P> addAssociations(ProgramEnvir.ProgramAssociation... elements) Adds elements toassociationslist.final ImmutableProgramWrapper.Builder<A,P> addErrors(ProgramEnvir.ProgramMessage element) Adds one element toerrorslist.final ImmutableProgramWrapper.Builder<A,P> addErrors(ProgramEnvir.ProgramMessage... elements) Adds elements toerrorslist.final ImmutableProgramWrapper.Builder<A,P> addHeaders(TypeDef element) Adds one element toheaderslist.final ImmutableProgramWrapper.Builder<A,P> addHeaders(TypeDef... elements) Adds elements toheaderslist.final ImmutableProgramWrapper.Builder<A,P> addWarnings(ProgramEnvir.ProgramMessage element) Adds one element towarningslist.final ImmutableProgramWrapper.Builder<A,P> addWarnings(ProgramEnvir.ProgramMessage... elements) Adds elements towarningslist.final ImmutableProgramWrapper.Builder<A,P> associations(Iterable<? extends ProgramEnvir.ProgramAssociation> elements) Sets or replaces all elements forassociationslist.final ImmutableProgramWrapper.Builder<A,P> Initializes the optional valueastto ast.final ImmutableProgramWrapper.Builder<A,P> Initializes the optional valueastto ast.build()Builds a newImmutableProgramWrapper.final ImmutableProgramWrapper.Builder<A,P> errors(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Sets or replaces all elements forerrorslist.final ImmutableProgramWrapper.Builder<A,P> from(ProgramEnvir.ProgramWrapper<A, P> instance) Fill a builder with attribute values from the providedProgramWrapperinstance.final ImmutableProgramWrapper.Builder<A,P> Sets or replaces all elements forheaderslist.final ImmutableProgramWrapper.Builder<A,P> Initializes the value for theidattribute.final ImmutableProgramWrapper.Builder<A,P> Initializes the optional valueprogramto program.final ImmutableProgramWrapper.Builder<A,P> Initializes the optional valueprogramto program.final ImmutableProgramWrapper.Builder<A,P> source(AstBody.AstSource source) Initializes the value for thesourceattribute.final ImmutableProgramWrapper.Builder<A,P> status(ProgramEnvir.ProgramStatus status) Initializes the value for thestatusattribute.final ImmutableProgramWrapper.Builder<A,P> type(AstBody.AstBodyType type) Initializes the value for thetypeattribute.final ImmutableProgramWrapper.Builder<A,P> warnings(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Sets or replaces all elements forwarningslist.
-
Method Details
-
from
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> from(ProgramEnvir.ProgramWrapper<A, P> instance) Fill a builder with attribute values from the providedProgramWrapperinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
id
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
type
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> type(AstBody.AstBodyType type) Initializes the value for thetypeattribute.- Parameters:
type- The value for type- Returns:
thisbuilder for use in a chained invocation
-
status
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> status(ProgramEnvir.ProgramStatus status) Initializes the value for thestatusattribute.- Parameters:
status- The value for status- Returns:
thisbuilder for use in a chained invocation
-
addWarnings
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addWarnings(ProgramEnvir.ProgramMessage element) Adds one element towarningslist.- Parameters:
element- A warnings element- Returns:
thisbuilder for use in a chained invocation
-
addWarnings
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addWarnings(ProgramEnvir.ProgramMessage... elements) Adds elements towarningslist.- Parameters:
elements- An array of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
warnings
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> warnings(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Sets or replaces all elements forwarningslist.- Parameters:
elements- An iterable of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
addAllWarnings
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAllWarnings(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Adds elements towarningslist.- Parameters:
elements- An iterable of warnings elements- Returns:
thisbuilder for use in a chained invocation
-
addErrors
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addErrors(ProgramEnvir.ProgramMessage element) Adds one element toerrorslist.- Parameters:
element- A errors element- Returns:
thisbuilder for use in a chained invocation
-
addErrors
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addErrors(ProgramEnvir.ProgramMessage... elements) Adds elements toerrorslist.- Parameters:
elements- An array of errors elements- Returns:
thisbuilder for use in a chained invocation
-
errors
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> errors(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Sets or replaces all elements forerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
addAllErrors
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAllErrors(Iterable<? extends ProgramEnvir.ProgramMessage> elements) Adds elements toerrorslist.- Parameters:
elements- An iterable of errors elements- Returns:
thisbuilder for use in a chained invocation
-
addHeaders
Adds one element toheaderslist.- Parameters:
element- A headers element- Returns:
thisbuilder for use in a chained invocation
-
addHeaders
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addHeaders(TypeDef... elements) Adds elements toheaderslist.- Parameters:
elements- An array of headers elements- Returns:
thisbuilder for use in a chained invocation
-
headers
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> headers(Iterable<? extends TypeDef> elements) Sets or replaces all elements forheaderslist.- Parameters:
elements- An iterable of headers elements- Returns:
thisbuilder for use in a chained invocation
-
addAllHeaders
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAllHeaders(Iterable<? extends TypeDef> elements) Adds elements toheaderslist.- Parameters:
elements- An iterable of headers elements- Returns:
thisbuilder for use in a chained invocation
-
addAssociations
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAssociations(ProgramEnvir.ProgramAssociation element) Adds one element toassociationslist.- Parameters:
element- A associations element- Returns:
thisbuilder for use in a chained invocation
-
addAssociations
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAssociations(ProgramEnvir.ProgramAssociation... elements) Adds elements toassociationslist.- Parameters:
elements- An array of associations elements- Returns:
thisbuilder for use in a chained invocation
-
associations
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> associations(Iterable<? extends ProgramEnvir.ProgramAssociation> elements) Sets or replaces all elements forassociationslist.- Parameters:
elements- An iterable of associations elements- Returns:
thisbuilder for use in a chained invocation
-
addAllAssociations
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> addAllAssociations(Iterable<? extends ProgramEnvir.ProgramAssociation> elements) Adds elements toassociationslist.- Parameters:
elements- An iterable of associations elements- Returns:
thisbuilder for use in a chained invocation
-
source
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> source(AstBody.AstSource source) Initializes the value for thesourceattribute.- Parameters:
source- The value for source- Returns:
thisbuilder for use in a chained invocation
-
ast
Initializes the optional valueastto ast.- Parameters:
ast- The value for ast- Returns:
thisbuilder for chained invocation
-
ast
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> ast(Optional<? extends A> ast) Initializes the optional valueastto ast.- Parameters:
ast- The value for ast- Returns:
thisbuilder for use in a chained invocation
-
program
Initializes the optional valueprogramto program.- Parameters:
program- The value for program- Returns:
thisbuilder for chained invocation
-
program
@CanIgnoreReturnValue public final ImmutableProgramWrapper.Builder<A,P> program(Optional<? extends P> program) Initializes the optional valueprogramto program.- Parameters:
program- The value for program- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableProgramWrapper.- Returns:
- An immutable instance of ProgramWrapper
- Throws:
IllegalStateException- if any required attributes are missing
-