public class ValidatorContextImpl extends Object implements HibernateValidatorContext
| Constructor and Description |
|---|
ValidatorContextImpl(ValidatorFactoryImpl validatorFactory) |
| Modifier and Type | Method and Description |
|---|---|
HibernateValidatorContext |
addValidationValueHandler(ValidatedValueUnwrapper<?> handler)
Registers the given validated value unwrapper with the bootstrapped validator.
|
HibernateValidatorContext |
allowMultipleCascadedValidationOnReturnValues(boolean allow)
Define whether more than one constraint on a return value may be marked for cascading validation are allowed.
|
HibernateValidatorContext |
allowOverridingMethodAlterParameterConstraint(boolean allow)
Define whether overriding methods that override constraints should throw a
ConstraintDefinitionException. |
HibernateValidatorContext |
allowParallelMethodsDefineParameterConstraints(boolean allow)
Define whether parallel methods that define constraints should throw a
ConstraintDefinitionException. |
HibernateValidatorContext |
constraintValidatorFactory(ConstraintValidatorFactory factory)
Defines the constraint validator factory implementation used by the
Validator. |
HibernateValidatorContext |
failFast(boolean failFast)
En- or disables the fail fast mode.
|
Validator |
getValidator()
Returns an initialized
Validator instance respecting the defined state. |
HibernateValidatorContext |
messageInterpolator(MessageInterpolator messageInterpolator)
Defines the message interpolator implementation used by the
Validator. |
HibernateValidatorContext |
parameterNameProvider(ParameterNameProvider parameterNameProvider)
Defines the parameter name provider implementation used by the
Validator. |
HibernateValidatorContext |
timeProvider(TimeProvider timeProvider)
Registers the given time provider with the bootstrapped validator.
|
HibernateValidatorContext |
traversableResolver(TraversableResolver traversableResolver)
Defines the traversable resolver implementation used by the
Validator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddValueExtractor, clockProviderpublic ValidatorContextImpl(ValidatorFactoryImpl validatorFactory)
public HibernateValidatorContext messageInterpolator(MessageInterpolator messageInterpolator)
ValidatorContextValidator.
If not set or if null is passed as a parameter,
the message interpolator of the ValidatorFactory
is used.
messageInterpolator in interface ValidatorContextmessageInterpolator in interface HibernateValidatorContextmessageInterpolator - the MessageInterpolator used by the
Validatorpublic HibernateValidatorContext traversableResolver(TraversableResolver traversableResolver)
ValidatorContextValidator.
If not set or if null is passed as a parameter,
the traversable resolver of the ValidatorFactory is used.
traversableResolver in interface ValidatorContexttraversableResolver in interface HibernateValidatorContexttraversableResolver - the TraversableResolver used by the
Validatorpublic HibernateValidatorContext constraintValidatorFactory(ConstraintValidatorFactory factory)
ValidatorContextValidator.
If not set or if null is passed as a parameter,
the constraint validator factory of the ValidatorFactory is used.constraintValidatorFactory in interface ValidatorContextconstraintValidatorFactory in interface HibernateValidatorContextfactory - the ConstraintValidatorFactory used by the Validatorpublic HibernateValidatorContext parameterNameProvider(ParameterNameProvider parameterNameProvider)
ValidatorContextValidator. If not set or if null is passed as a parameter,
the parameter name provider of the ValidatorFactory is used.parameterNameProvider in interface ValidatorContextparameterNameProvider in interface HibernateValidatorContextparameterNameProvider - parameter name provider implementation.public HibernateValidatorContext failFast(boolean failFast)
HibernateValidatorContextfailFast in interface HibernateValidatorContextfailFast - true to enable fail fast, false otherwise.this following the chaining method patternpublic HibernateValidatorContext addValidationValueHandler(ValidatedValueUnwrapper<?> handler)
HibernateValidatorContextUnwrapValidatedValue, the unwrapper will be applied to retrieve the
value to validate.addValidationValueHandler in interface HibernateValidatorContexthandler - the unwrapper to registerthis following the chaining method patternpublic HibernateValidatorContext timeProvider(TimeProvider timeProvider)
HibernateValidatorContext@Future and @Past constraints. If not set or if null is
passed as a parameter, the time provider of the ValidatorFactory is used.timeProvider in interface HibernateValidatorContexttimeProvider - the time provider to register.this following the chaining method patternpublic HibernateValidatorContext allowOverridingMethodAlterParameterConstraint(boolean allow)
HibernateValidatorContextConstraintDefinitionException.
The default value is false, i.e. do not allow.
See Section 4.5.5 of the JSR 349 specification, specifically
"In sub types (be it sub classes/interfaces or interface implementations), no parameter constraints may be declared on overridden or implemented methods, nor may parameters be marked for cascaded validation. This would pose a strengthening of preconditions to be fulfilled by the caller."
allowOverridingMethodAlterParameterConstraint in interface HibernateValidatorContextallow - flag determining whether validation will allow overriding to alter parameter constraints.this following the chaining method patternpublic HibernateValidatorContext allowMultipleCascadedValidationOnReturnValues(boolean allow)
HibernateValidatorContextfalse, i.e. do not allow.
See Section 4.5.5 of the JSR 349 specification, specifically
"One must not mark a method return value for cascaded validation more than once in a line of a class hierarchy. In other words, overriding methods on sub types (be it sub classes/interfaces or interface implementations) cannot mark the return value for cascaded validation if the return value has already been marked on the overridden method of the super type or interface."
allowMultipleCascadedValidationOnReturnValues in interface HibernateValidatorContextallow - flag determining whether validation will allow multiple cascaded validation on return values.this following the chaining method patternpublic HibernateValidatorContext allowParallelMethodsDefineParameterConstraints(boolean allow)
HibernateValidatorContextConstraintDefinitionException. The
default value is false, i.e. do not allow.
See Section 4.5.5 of the JSR 349 specification, specifically
"If a sub type overrides/implements a method originally defined in several parallel types of the hierarchy (e.g. two interfaces not extending each other, or a class and an interface not implemented by said class), no parameter constraints may be declared for that method at all nor parameters be marked for cascaded validation. This again is to avoid an unexpected strengthening of preconditions to be fulfilled by the caller."
allowParallelMethodsDefineParameterConstraints in interface HibernateValidatorContextallow - flag determining whether validation will allow parameter constraints in parallel hierarchiesthis following the chaining method patternpublic Validator getValidator()
ValidatorContextValidator instance respecting the defined state.
Validator instances can be pooled and shared by the implementation.getValidator in interface ValidatorContextValidatorCopyright © 2018 JBoss by Red Hat. All rights reserved.