Class MethodValidationConfiguration.Builder
- java.lang.Object
-
- org.hibernate.validator.internal.engine.MethodValidationConfiguration.Builder
-
- Enclosing class:
- MethodValidationConfiguration
public static class MethodValidationConfiguration.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()Builder(MethodValidationConfiguration template)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodValidationConfiguration.BuilderallowMultipleCascadedValidationOnReturnValues(boolean allow)Define whether more than one constraint on a return value may be marked for cascading validation are allowed.MethodValidationConfiguration.BuilderallowOverridingMethodAlterParameterConstraint(boolean allow)Define whether overriding methods that override constraints should throw aConstraintDefinitionException.MethodValidationConfiguration.BuilderallowParallelMethodsDefineParameterConstraints(boolean allow)Define whether parallel methods that define constraints should throw aConstraintDefinitionException.MethodValidationConfigurationbuild()booleanisAllowMultipleCascadedValidationOnReturnValues()booleanisAllowOverridingMethodAlterParameterConstraint()booleanisAllowParallelMethodsDefineParameterConstraints()
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(MethodValidationConfiguration template)
-
-
Method Detail
-
allowOverridingMethodAlterParameterConstraint
public MethodValidationConfiguration.Builder allowOverridingMethodAlterParameterConstraint(boolean allow)
Define whether overriding methods that override constraints should throw aConstraintDefinitionException. The default value isfalse, i.e. do not allow. See Section 5.6.5 of the Jakarta Bean Validation 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."
- Parameters:
allow- flag determining whether validation will allow overriding to alter parameter constraints.- Returns:
thisfollowing the chaining method pattern
-
allowMultipleCascadedValidationOnReturnValues
public MethodValidationConfiguration.Builder allowMultipleCascadedValidationOnReturnValues(boolean allow)
Define 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. "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."- Parameters:
allow- flag determining whether validation will allow multiple cascaded validation on return values.- Returns:
thisfollowing the chaining method pattern
-
allowParallelMethodsDefineParameterConstraints
public MethodValidationConfiguration.Builder allowParallelMethodsDefineParameterConstraints(boolean allow)
Define whether parallel methods that define constraints should throw aConstraintDefinitionException. The default value isfalse, i.e. do not allow. See Section 5.6.5 of the Jakarta Bean Validation 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."- Parameters:
allow- flag determining whether validation will allow parameter constraints in parallel hierarchies- Returns:
thisfollowing the chaining method pattern
-
isAllowOverridingMethodAlterParameterConstraint
public boolean isAllowOverridingMethodAlterParameterConstraint()
-
isAllowMultipleCascadedValidationOnReturnValues
public boolean isAllowMultipleCascadedValidationOnReturnValues()
-
isAllowParallelMethodsDefineParameterConstraints
public boolean isAllowParallelMethodsDefineParameterConstraints()
-
build
public MethodValidationConfiguration build()
-
-