public static final class ImmutableEither.Builder<L,R> extends Object
ImmutableEither.
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 |
|---|---|
ImmutableEither<L,R> |
build()
Builds a new
ImmutableEither. |
ImmutableEither.Builder<L,R> |
from(Either<L,R> instance)
Fill a builder with attribute values from the provided
Either instance. |
ImmutableEither.Builder<L,R> |
optLeft(L optLeft)
Initializes the optional value
optLeft to optLeft. |
ImmutableEither.Builder<L,R> |
optLeft(Optional<L> optLeft)
Initializes the optional value
optLeft to optLeft. |
ImmutableEither.Builder<L,R> |
optRight(Optional<R> optRight)
Initializes the optional value
optRight to optRight. |
ImmutableEither.Builder<L,R> |
optRight(R optRight)
Initializes the optional value
optRight to optRight. |
public final ImmutableEither.Builder<L,R> from(Either<L,R> instance)
Either 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 ImmutableEither.Builder<L,R> optLeft(L optLeft)
optLeft to optLeft.optLeft - The value for optLeftthis builder for chained invocationpublic final ImmutableEither.Builder<L,R> optLeft(Optional<L> optLeft)
optLeft to optLeft.optLeft - The value for optLeftthis builder for use in a chained invocationpublic final ImmutableEither.Builder<L,R> optRight(R optRight)
optRight to optRight.optRight - The value for optRightthis builder for chained invocationpublic final ImmutableEither.Builder<L,R> optRight(Optional<R> optRight)
optRight to optRight.optRight - The value for optRightthis builder for use in a chained invocationpublic ImmutableEither<L,R> build()
ImmutableEither.IllegalStateException - if any required attributes are missingCopyright © 2017. All rights reserved.