Class ValidatorSequence<V>
- Type Parameters:
V- type of the object to be validated
- All Implemented Interfaces:
Validator<V>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
Validator implementation which encapsulates the functionality of stepping
through a sequence of other validators.
The validate(V, net.shibboleth.metadata.Item<?>, java.lang.String, java.lang.String) method of this class returns the
Validator.Action.DONE value
to indicate that one of the called validators returned that value.- Since:
- 0.10.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.shibboleth.metadata.validate.Validator
Validator.Action -
Field Summary
FieldsModifier and TypeFieldDescriptionThe list of validators to apply. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidGets the list of validators being applied to each item.voidsetValidators(List<Validator<V>> newValidators) Set the list of validators to apply to each item.Apply the validator to a value in the context of the givenItem.Methods inherited from class net.shibboleth.metadata.validate.BaseValidator
addError, addErrorMessage, addErrorMessage, addErrorMessage, addStatus, addWarning, getMessage, makeComponentId, setMessageMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiableComponent
setIdMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
validators
The list of validators to apply.
-
-
Constructor Details
-
ValidatorSequence
public ValidatorSequence()
-
-
Method Details
-
setValidators
Set the list of validators to apply to each item.- Parameters:
newValidators- the list of validators to set
-
getValidators
Gets the list of validators being applied to each item.- Returns:
- list of validators
-
validate
@Nonnull public Validator.Action validate(@Nonnull V value, @Nonnull Item<?> item, @Nonnull String callerId, @Nullable String valueContext) throws StageProcessingException Description copied from interface:ValidatorApply the validator to a value in the context of the givenItem.The validator influences future processing by adding item metadata to the
Item.A common case is that the validator will add a
StatusMetadatato theItem, for example aErrorStatus. In this case, the convention is that thecomponentIdof theErrorStatuswould be created by combining thecallerIdwith a/and the validator's own identifier. For example, a validatorvalcalled by a stagestagewould normally use acomponentIdofstage/val.The
valueContextmakes the original context of thevalueavailable to help in constructing meaningful error messages. For example, the validation of a complex structured value such as a URI might be broken down into multiple sub-validations of its components: scheme, for example. When relevant, thevalueContextprovides a representation of the original complex value whilevalueis the component currently being validated.- Specified by:
validatein interfaceValidator<V>- Parameters:
value- the value to be validateditem- theItemcontext for the validationcallerId- aStringidentifying the callervalueContext- an additionalStringindicating the value context, ornull- Returns:
- an indication of whether to process additional validators
- Throws:
StageProcessingException- if an error occurs during validation
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-