Class ValidatorContextImpl
java.lang.Object
org.hibernate.validator.internal.engine.ValidatorContextImpl
- All Implemented Interfaces:
jakarta.validation.ValidatorContext,HibernateValidatorContext
- Author:
- Emmanuel Bernard, Hardy Ferentschik, Kevin Pollet <[email protected]> (C) 2011 SERLI, Gunnar Morling, Chris Beckey <[email protected]>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddValueExtractor(jakarta.validation.valueextraction.ValueExtractor<?> extractor) allowMultipleCascadedValidationOnReturnValues(boolean allow) Define whether more than one constraint on a return value may be marked for cascading validation are allowed.allowOverridingMethodAlterParameterConstraint(boolean allow) Define whether overriding methods that override constraints should throw aConstraintDefinitionException.allowParallelMethodsDefineParameterConstraints(boolean allow) Define whether parallel methods that define constraints should throw aConstraintDefinitionException.clockProvider(jakarta.validation.ClockProvider clockProvider) constraintValidatorFactory(jakarta.validation.ConstraintValidatorFactory factory) constraintValidatorPayload(Object dynamicPayload) Define a payload passed to the constraint validators.enableTraversableResolverResultCache(boolean enabled) Define whether the per validation call caching ofTraversableResolverresults is enabled.failFast(boolean failFast) En- or disables the fail fast mode.jakarta.validation.ValidatormessageInterpolator(jakarta.validation.MessageInterpolator messageInterpolator) parameterNameProvider(jakarta.validation.ParameterNameProvider parameterNameProvider) temporalValidationTolerance(Duration temporalValidationTolerance) Define the temporal validation tolerance i.e.traversableResolver(jakarta.validation.TraversableResolver traversableResolver)
-
Constructor Details
-
ValidatorContextImpl
-
-
Method Details
-
messageInterpolator
public HibernateValidatorContext messageInterpolator(jakarta.validation.MessageInterpolator messageInterpolator) - Specified by:
messageInterpolatorin interfaceHibernateValidatorContext- Specified by:
messageInterpolatorin interfacejakarta.validation.ValidatorContext
-
traversableResolver
public HibernateValidatorContext traversableResolver(jakarta.validation.TraversableResolver traversableResolver) - Specified by:
traversableResolverin interfaceHibernateValidatorContext- Specified by:
traversableResolverin interfacejakarta.validation.ValidatorContext
-
constraintValidatorFactory
public HibernateValidatorContext constraintValidatorFactory(jakarta.validation.ConstraintValidatorFactory factory) - Specified by:
constraintValidatorFactoryin interfaceHibernateValidatorContext- Specified by:
constraintValidatorFactoryin interfacejakarta.validation.ValidatorContext
-
parameterNameProvider
public HibernateValidatorContext parameterNameProvider(jakarta.validation.ParameterNameProvider parameterNameProvider) - Specified by:
parameterNameProviderin interfaceHibernateValidatorContext- Specified by:
parameterNameProviderin interfacejakarta.validation.ValidatorContext
-
clockProvider
- Specified by:
clockProviderin interfaceHibernateValidatorContext- Specified by:
clockProviderin interfacejakarta.validation.ValidatorContext
-
addValueExtractor
public HibernateValidatorContext addValueExtractor(jakarta.validation.valueextraction.ValueExtractor<?> extractor) - Specified by:
addValueExtractorin interfaceHibernateValidatorContext- Specified by:
addValueExtractorin interfacejakarta.validation.ValidatorContext
-
failFast
Description copied from interface:HibernateValidatorContextEn- or disables the fail fast mode. When fail fast is enabled the validation will stop on the first constraint violation detected.- Specified by:
failFastin interfaceHibernateValidatorContext- Parameters:
failFast-trueto enable fail fast,falseotherwise.- Returns:
thisfollowing the chaining method pattern
-
allowOverridingMethodAlterParameterConstraint
Description copied from interface:HibernateValidatorContextDefine whether overriding methods that override constraints should throw aConstraintDefinitionException. The default value isfalse, i.e. do not allow.See Section 4.5.5 of the JSR 380 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."
- Specified by:
allowOverridingMethodAlterParameterConstraintin interfaceHibernateValidatorContext- Parameters:
allow- flag determining whether validation will allow overriding to alter parameter constraints.- Returns:
thisfollowing the chaining method pattern
-
allowMultipleCascadedValidationOnReturnValues
Description copied from interface:HibernateValidatorContextDefine whether more than one constraint on a return value may be marked for cascading validation are allowed. The default value isfalse, i.e. do not allow.See Section 4.5.5 of the JSR 380 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."
- Specified by:
allowMultipleCascadedValidationOnReturnValuesin interfaceHibernateValidatorContext- Parameters:
allow- flag determining whether validation will allow multiple cascaded validation on return values.- Returns:
thisfollowing the chaining method pattern
-
allowParallelMethodsDefineParameterConstraints
Description copied from interface:HibernateValidatorContextDefine whether parallel methods that define constraints should throw aConstraintDefinitionException. The default value isfalse, i.e. do not allow.See Section 4.5.5 of the JSR 380 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."
- Specified by:
allowParallelMethodsDefineParameterConstraintsin interfaceHibernateValidatorContext- Parameters:
allow- flag determining whether validation will allow parameter constraints in parallel hierarchies- Returns:
thisfollowing the chaining method pattern
-
enableTraversableResolverResultCache
Description copied from interface:HibernateValidatorContextDefine whether the per validation call caching ofTraversableResolverresults is enabled. The default value istrue, i.e. the caching is enabled.This behavior was initially introduced to cache the
JPATraversableResolverresults but the map lookups it introduces can be counterproductive when theTraversableResolvercalls are very fast.- Specified by:
enableTraversableResolverResultCachein interfaceHibernateValidatorContext- Parameters:
enabled- flag determining whether per validation call caching is enabled forTraversableResolverresults.- Returns:
thisfollowing the chaining method pattern
-
temporalValidationTolerance
Description copied from interface:HibernateValidatorContextDefine the temporal validation tolerance i.e. the acceptable margin of error when comparing date/time in temporal constraints.- Specified by:
temporalValidationTolerancein interfaceHibernateValidatorContext- Parameters:
temporalValidationTolerance- the tolerance- Returns:
thisfollowing the chaining method pattern
-
constraintValidatorPayload
Description copied from interface:HibernateValidatorContextDefine a payload passed to the constraint validators. If the method is called multiple times, only the payload passed last will be propagated.- Specified by:
constraintValidatorPayloadin interfaceHibernateValidatorContext- Parameters:
dynamicPayload- the payload passed to constraint validators- Returns:
thisfollowing the chaining method pattern
-
getValidator
public jakarta.validation.Validator getValidator()- Specified by:
getValidatorin interfacejakarta.validation.ValidatorContext
-