public interface HibernateValidatorContext extends ValidatorContext
Validator
instances. Adds additional configuration options to those
provided by ValidatorContext
.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.
|
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 . |
getValidator
HibernateValidatorContext messageInterpolator(MessageInterpolator messageInterpolator)
ValidatorContext
Validator
.
If not set or if null
is passed as a parameter,
the message interpolator of the ValidatorFactory
is used.messageInterpolator
in interface ValidatorContext
messageInterpolator
- the MessageInterpolator
used by the Validator
HibernateValidatorContext traversableResolver(TraversableResolver traversableResolver)
ValidatorContext
Validator
.
If not set or if null
is passed as a parameter,
the traversable resolver of the ValidatorFactory
is used.traversableResolver
in interface ValidatorContext
traversableResolver
- the TraversableResolver
used by the Validator
HibernateValidatorContext constraintValidatorFactory(ConstraintValidatorFactory factory)
ValidatorContext
Validator
.
If not set or if null
is passed as a parameter,
the constraint validator factory of the ValidatorFactory
is used.constraintValidatorFactory
in interface ValidatorContext
factory
- the ConstraintValidatorFactory
used by the Validator
HibernateValidatorContext parameterNameProvider(ParameterNameProvider parameterNameProvider)
ValidatorContext
Validator
. If not set or if null
is passed as a parameter,
the parameter name provider of the ValidatorFactory
is used.parameterNameProvider
in interface ValidatorContext
parameterNameProvider
- parameter name provider implementation.HibernateValidatorContext failFast(boolean failFast)
failFast
- true
to enable fail fast, false
otherwise.this
following the chaining method patternHibernateValidatorContext addValidationValueHandler(ValidatedValueUnwrapper<?> handler)
UnwrapValidatedValue
, the unwrapper will be applied to retrieve the
value to validate.handler
- the unwrapper to registerthis
following the chaining method patternHibernateValidatorContext timeProvider(TimeProvider timeProvider)
@Future
and @Past
constraints. If not set or if null
is
passed as a parameter, the time provider of the ValidatorFactory
is used.timeProvider
- the time provider to register.this
following the chaining method patternHibernateValidatorContext allowOverridingMethodAlterParameterConstraint(boolean allow)
ConstraintDefinitionException
.
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."
allow
- flag determining whether validation will allow overriding to alter parameter constraints.this
following the chaining method patternHibernateValidatorContext allowMultipleCascadedValidationOnReturnValues(boolean allow)
false
, 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."
allow
- flag determining whether validation will allow multiple cascaded validation on return values.this
following the chaining method patternHibernateValidatorContext allowParallelMethodsDefineParameterConstraints(boolean allow)
ConstraintDefinitionException
. 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."
allow
- flag determining whether validation will allow parameter constraints in parallel hierarchiesthis
following the chaining method patternCopyright © 2017 JBoss by Red Hat. All rights reserved.