B
- the type of the Builder itselfT
- the type being built by the build()
method of this builder.@NotThreadSafe public abstract static class AbstractLightRequest.AbstractBuilder<B extends AbstractLightRequest.AbstractBuilder<B,T>,T extends ILightRequest> extends Object
Abstract Builder pattern with self-bounding generics for ILightRequest
subtypes.
Effective Java, 2nd Ed. : Item 2: Builder Pattern.
This Builder is not thread-safe but is thread-compliant, it is supposed to be used by only one thread. See Self-bounding generics: @see http://www.artima.com/weblogs/viewpost.jsp?thread=136394
Modifier | Constructor and Description |
---|---|
protected |
AbstractBuilder() |
protected |
AbstractBuilder(AbstractLightRequest.AbstractBuilder<?,?> copy) |
protected |
AbstractBuilder(ILightRequest copy) |
Modifier and Type | Method and Description |
---|---|
T |
build()
Builds a new
T instance based on this Builder instance (Builder pattern for ILightRequest ). |
B |
citizenCountryCode(String citizenCountryCode) |
B |
id(String id) |
B |
issuer(String issuer) |
B |
levelOfAssurance(String levelOfAssurance) |
B |
levelsOfAssurance(List<? extends ILevelOfAssurance> levelsOfAssurance) |
B |
levelsOfAssuranceValues(List<String> levelsOfAssurance) |
B |
nameIdFormat(String nameIdFormat) |
protected abstract T |
newInstance()
Method to be implemented by subtypes to create the right type
T of instances. |
B |
providerName(String providerName) |
B |
relayState(String relayState) |
B |
requestedAttributes(ImmutableAttributeMap requestedAttributes) |
B |
requesterId(String requesterId) |
B |
spCountryCode(String spCountryCode) |
B |
spType(String spType) |
protected void |
validate()
Validates the state of this Builder before allowing to create new instances of the built type
T . |
protected AbstractBuilder()
protected AbstractBuilder(@Nonnull AbstractLightRequest.AbstractBuilder<?,?> copy)
protected AbstractBuilder(@Nonnull ILightRequest copy)
@Nonnull public final B levelsOfAssurance(List<? extends ILevelOfAssurance> levelsOfAssurance)
@Nonnull public final B levelsOfAssuranceValues(List<String> levelsOfAssurance)
@Nonnull public final B requestedAttributes(ImmutableAttributeMap requestedAttributes)
protected void validate() throws IllegalArgumentException
T
.IllegalArgumentException
- if the builder is not in a legal state allowing to proceed with the creation
of a T
instance.@Nonnull public final T build()
Builds a new T
instance based on this Builder instance (Builder pattern for ILightRequest
).
The validate()
is always called before creating a new instance through a call to the newInstance()
method.
T
instance based on this Builder instance.Copyright © 2020. All Rights Reserved.