Package pl.poznan.put.external.dssr
Class ImmutablePair.Builder
- java.lang.Object
-
- pl.poznan.put.external.dssr.ImmutablePair.Builder
-
- Enclosing class:
- ImmutablePair
@NotThreadSafe public static final class ImmutablePair.Builder extends Object
Builds instances of typeImmutablePair. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutablePairbuild()Builds a newImmutablePair.ImmutablePair.Builderfrom(Pair instance)Fill a builder with attribute values from the providedPairinstance.ImmutablePair.Builderlw(String lw)Initializes the value for thelwattribute.ImmutablePair.Buildernt1(String nt1)Initializes the value for thent1attribute.ImmutablePair.Buildernt2(String nt2)Initializes the value for thent2attribute.ImmutablePair.Buildersaenger(String saenger)Initializes the value for thesaengerattribute.
-
-
-
Method Detail
-
from
public final ImmutablePair.Builder from(Pair instance)
Fill a builder with attribute values from the providedPairinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
nt1
public final ImmutablePair.Builder nt1(String nt1)
Initializes the value for thent1attribute.- Parameters:
nt1- The value for nt1- Returns:
thisbuilder for use in a chained invocation
-
nt2
public final ImmutablePair.Builder nt2(String nt2)
Initializes the value for thent2attribute.- Parameters:
nt2- The value for nt2- Returns:
thisbuilder for use in a chained invocation
-
saenger
public final ImmutablePair.Builder saenger(String saenger)
Initializes the value for thesaengerattribute.- Parameters:
saenger- The value for saenger- Returns:
thisbuilder for use in a chained invocation
-
lw
public final ImmutablePair.Builder lw(String lw)
Initializes the value for thelwattribute.- Parameters:
lw- The value for lw- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutablePair build()
Builds a newImmutablePair.- Returns:
- An immutable instance of Pair
- Throws:
IllegalStateException- if any required attributes are missing
-
-