@NotThreadSafe public abstract static class AbstractAuthenticationResponse.AbstractBuilder<B extends AbstractAuthenticationResponse.AbstractBuilder<B,T>,T extends IAuthenticationResponse> extends Object
IAuthenticationResponse
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:
http://www.artima.com/weblogs/viewpost.jsp?thread=136394
http://www.artima.com/forums/flat.jsp?forum=106&thread=136394
http://en.wikipedia.org/wiki/Covariance_and_contravariance
Modifier | Constructor and Description |
---|---|
protected |
AbstractBuilder() |
protected |
AbstractBuilder(AbstractAuthenticationResponse.AbstractBuilder<?,?> copy) |
protected |
AbstractBuilder(IAuthenticationResponse copy) |
Modifier and Type | Method and Description |
---|---|
B |
attributes(eu.eidas.auth.commons.attribute.ImmutableAttributeMap attributes) |
B |
audienceRestriction(String audienceRest) |
T |
build()
Builds a new
T instance based on this Builder instance (Builder pattern for IAuthenticationResponse ). |
B |
consent(String consent) |
B |
country(String country) |
B |
encrypted(boolean encrypted) |
B |
encrypted(Boolean encrypted) |
B |
failure(boolean failure) |
B |
failure(Boolean failure) |
B |
id(String id) |
B |
inResponseTo(String inResponseTo) |
B |
ipAddress(String ipAddress) |
B |
issuer(String issuer) |
B |
levelOfAssurance(String levelOfAssurance) |
B |
lightResponse(eu.eidas.auth.commons.light.ILightResponse lightResponse) |
protected abstract T |
newInstance()
Method to be implemented by subtypes to create the right type
T of instances. |
B |
notBefore(org.joda.time.DateTime notBefore) |
B |
notOnOrAfter(org.joda.time.DateTime notOnOrAfter) |
B |
relayState(String relayState) |
B |
responseStatus(eu.eidas.auth.commons.light.IResponseStatus responseStatus) |
B |
statusCode(String statusCode) |
B |
statusMessage(String statusMessage) |
B |
subject(String subject) |
B |
subjectNameIdFormat(String subjectNameIdFormat) |
B |
subStatusCode(String subStatusCode) |
protected abstract void |
validate()
Validates the state of this Builder before allowing to create new instances of the built type
T . |
protected AbstractBuilder()
protected AbstractBuilder(@Nonnull AbstractAuthenticationResponse.AbstractBuilder<?,?> copy)
protected AbstractBuilder(@Nonnull IAuthenticationResponse copy)
@Nonnull public final B lightResponse(@Nonnull eu.eidas.auth.commons.light.ILightResponse lightResponse)
@Nonnull public final B responseStatus(@Nonnull eu.eidas.auth.commons.light.IResponseStatus responseStatus)
@Nonnull public final B attributes(eu.eidas.auth.commons.attribute.ImmutableAttributeMap attributes)
protected abstract 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()
T
instance based on this Builder instance (Builder pattern for IAuthenticationResponse
).
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.