Class AbstractConfigurationImpl<T extends BaseHibernateValidatorConfiguration<T>>
- All Implemented Interfaces:
Configuration<T>,ConfigurationState,BaseHibernateValidatorConfiguration<T>
- Direct Known Subclasses:
ConfigurationImpl,PredefinedScopeConfigurationImpl
Configuration implementation.- Author:
- Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI, Chris Beckey <cbeckey@paypal.com>, Guillaume Smet
-
Field Summary
Fields inherited from interface org.hibernate.validator.BaseHibernateValidatorConfiguration
ALLOW_MULTIPLE_CASCADED_VALIDATION_ON_RESULT, ALLOW_PARALLEL_METHODS_DEFINE_PARAMETER_CONSTRAINTS, ALLOW_PARAMETER_CONSTRAINT_OVERRIDE, CONSTRAINT_EXPRESSION_LANGUAGE_FEATURE_LEVEL, CONSTRAINT_MAPPING_CONTRIBUTOR, CONSTRAINT_MAPPING_CONTRIBUTORS, CUSTOM_VIOLATION_EXPRESSION_LANGUAGE_FEATURE_LEVEL, ENABLE_TRAVERSABLE_RESOLVER_RESULT_CACHE, FAIL_FAST, GETTER_PROPERTY_SELECTION_STRATEGY_CLASSNAME, LOCALE_RESOLVER_CLASSNAME, PROPERTY_NODE_NAME_PROVIDER_CLASSNAME, SCRIPT_EVALUATOR_FACTORY_CLASSNAME, SHOW_VALIDATED_VALUE_IN_TRACE_LOGS, TEMPORAL_VALIDATION_TOLERANCE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractConfigurationImpl(ValidationProvider<?> provider) -
Method Summary
Modifier and TypeMethodDescriptionfinal TaddMapping(InputStream stream) Add a stream describing constraint mapping in the Jakarta Bean Validation XML format.final TaddMapping(ConstraintMapping mapping) Adds the specifiedConstraintMappinginstance to the configuration.final TaddProperty(String name, String value) Adds a provider specific property.addValueExtractor(ValueExtractor<?> extractor) Adds a value 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.beanMetaDataClassNormalizer(BeanMetaDataClassNormalizer beanMetaDataClassNormalizer) final ValidatorFactoryBuild aValidatorFactoryimplementation.clockProvider(ClockProvider clockProvider) Defines the clock provider.constraintExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel) Allows setting the Expression Language feature level for message interpolation of constraint messages.final TconstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) Defines the constraint validator factory.constraintValidatorPayload(Object constraintValidatorPayload) Allows to set a payload which will be passed to the constraint validators.final DefaultConstraintMappingCreates a new constraint mapping which can be used to programmatically configure the constraints for given types.customViolationExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel) Allows setting the Expression Language feature level for message interpolation of custom violation messages.defaultLocale(Locale defaultLocale) Allows setting the default locale used to interpolate the constraint violation messages.final TenableTraversableResolverResultCache(boolean enabled) Define whether the per validation call caching ofTraversableResolverresults is enabled.externalClassLoader(ClassLoader externalClassLoader) Sets the class loader to be used for loading user-provided resources: XML descriptors (META-INF/validation.xmlas well as XML constraint mappings) classes specified by name in XML descriptors (e.g. custom message interpolators etc.) theValidationMessagesresource bundle If no class loader is given, these resources will be obtained through the thread context class loader and as a last fallback through Hibernate Validator's own class loader.final TfailFast(boolean failFast) En- or disables the fail fast mode.Returns configuration information stored in theMETA-INF/validation.xmlfile.Returns the clock provider for this configuration.Returns the constraint validator factory of this configuration.Returns an implementation of theClockProviderinterface following the defaultClockProviderdefined in the specification: returns a clock representing the current system time and default time zone.Returns an implementation of theConstraintValidatorFactoryinterface following the defaultConstraintValidatorFactorydefined in the specification: uses the public no-arg constructor of theConstraintValidatorfinal MessageInterpolatorReturns an implementation of theMessageInterpolatorinterface following the defaultMessageInterpolatordefined in the specification: use theValidationMessagesresource bundle to load keys useLocale.getDefault()Returns an implementation of theParameterNameProviderinterface following the defaultParameterNameProviderdefined in the specification: returns the actual parameter names as provided in the validated executable’s definition, if the class file of the executable contains parameter name information otherwise returns names in the formarg<PARAMETER_INDEX>, wherePARAMETER_INDEXstarts at 0 for the first parameter, e.g.final ResourceBundleLocatorReturns theResourceBundleLocatorused by thedefault message interpolatorto load user-provided resource bundles.final TraversableResolverReturns an implementation of theTraversableResolverinterface following the defaultTraversableResolverdefined in the specification: if Java Persistence is available in the runtime environment, a property is considered reachable if Java Persistence considers the property as loaded if Java Persistence is not available in the runtime environment, all properties are considered reachable all properties are considered cascadable.Set<ValueExtractor<?>>Returns the defaultValueExtractorimplementations as per the specification.final booleanfinal Set<InputStream>Returns a set of configuration streams.final MessageInterpolatorReturns the message interpolator of this configuration.Returns the parameter name provider for this configuration.final Set<DefaultConstraintMapping>Returns a map of non type-safe custom properties.final booleangetterPropertySelectionStrategy(GetterPropertySelectionStrategy getterPropertySelectionStrategy) Allows to set a getter property selection strategy defining the rules determining if a method is a getter or not.final TraversableResolverReturns the traversable resolver for this configuration.Set<ValueExtractor<?>>Returns a set of value extractors.final TIgnores data from theMETA-INF/validation.xmlfile if this method is called.booleanbooleanbooleanfinal booleanReturnstrueifConfiguration.ignoreXmlConfiguration()has been called.final booleanlocaleResolver(LocaleResolver localeResolver) Allows setting a locale resolver, defining how the locale will be resolved when interpolating the message of a constraint violation.Allows setting the list of the locales supported by this ValidatorFactory.final TmessageInterpolator(MessageInterpolator interpolator) Defines the message interpolator used.parameterNameProvider(ParameterNameProvider parameterNameProvider) Defines the parameter name provider.protected abstract booleanpropertyNodeNameProvider(PropertyNodeNameProvider propertyNodeNameProvider) Allows to set a property node name provider, defining how the name of a property node will be resolved when constructing a property path as the one returned byConstraintViolation.getPropertyPath().scriptEvaluatorFactory(ScriptEvaluatorFactory scriptEvaluatorFactory) Allows to specify a customScriptEvaluatorFactoryresponsible for creatingScriptEvaluators used to evaluate script expressions forScriptAssertandParameterScriptAssertconstraints.showValidatedValuesInTraceLogs(boolean enabled) Allows setting the logging configuration that would include validated values in trace level logs.temporalValidationTolerance(Duration temporalValidationTolerance) Allows to set the acceptable margin of error when comparing date/time in temporal constraints such asPast/PastOrPresentandFuture/FutureOrPresent.protected TthisAsT()final TtraversableResolver(TraversableResolver resolver) Defines the traversable resolver used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.validator.BaseHibernateValidatorConfiguration
locales
-
Constructor Details
-
AbstractConfigurationImpl
-
AbstractConfigurationImpl
-
-
Method Details
-
ignoreXmlConfiguration
Description copied from interface:ConfigurationIgnores data from theMETA-INF/validation.xmlfile if this method is called.This method is typically useful for containers that parse
META-INF/validation.xmlthemselves and pass the information via theConfigurationmethods.- Specified by:
ignoreXmlConfigurationin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
thisfollowing the chaining method pattern.
-
messageInterpolator
Description copied from interface:ConfigurationDefines the message interpolator used. Has priority over the configuration based message interpolator.If
nullis passed, the default message interpolator is used (defined in XML or the specification default).- Specified by:
messageInterpolatorin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
interpolator- message interpolator implementation- Returns:
thisfollowing the chaining method pattern
-
traversableResolver
Description copied from interface:ConfigurationDefines the traversable resolver used. Has priority over the configuration based traversable resolver.If
nullis passed, the default traversable resolver is used (defined in XML or the specification default).- Specified by:
traversableResolverin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
resolver- traversable resolver implementation- Returns:
thisfollowing the chaining method pattern
-
enableTraversableResolverResultCache
Description copied from interface:BaseHibernateValidatorConfigurationDefine 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 interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
enabled- flag determining whether per validation call caching is enabled forTraversableResolverresults.- Returns:
thisfollowing the chaining method pattern
-
isTraversableResolverResultCacheEnabled
public final boolean isTraversableResolverResultCacheEnabled() -
constraintValidatorFactory
Description copied from interface:ConfigurationDefines the constraint validator factory. Has priority over the configuration based constraint factory.If
nullis passed, the default constraint validator factory is used (defined in XML or the specification default).- Specified by:
constraintValidatorFactoryin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
constraintValidatorFactory- constraint factory implementation- Returns:
thisfollowing the chaining method pattern
-
parameterNameProvider
Description copied from interface:ConfigurationDefines the parameter name provider. Has priority over the configuration based provider.If
nullis passed, the default parameter name provider is used (defined in XML or the specification default).- Specified by:
parameterNameProviderin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
parameterNameProvider- parameter name provider implementation- Returns:
thisfollowing the chaining method pattern.
-
clockProvider
Description copied from interface:ConfigurationDefines the clock provider. Has priority over the configuration based provider.If
nullis passed, the default clock provider is used (defined in XML or the specification default).- Specified by:
clockProviderin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
clockProvider- clock provider implementation- Returns:
thisfollowing the chaining method pattern.
-
propertyNodeNameProvider
Description copied from interface:BaseHibernateValidatorConfigurationAllows to set a property node name provider, defining how the name of a property node will be resolved when constructing a property path as the one returned byConstraintViolation.getPropertyPath().- Specified by:
propertyNodeNameProviderin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
propertyNodeNameProvider- thePropertyNodeNameProviderto be used- Returns:
thisfollowing the chaining method pattern
-
localeResolver
Description copied from interface:BaseHibernateValidatorConfigurationAllows setting a locale resolver, defining how the locale will be resolved when interpolating the message of a constraint violation.- Specified by:
localeResolverin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
localeResolver- theLocaleResolverto be used- Returns:
thisfollowing the chaining method pattern
-
addValueExtractor
Description copied from interface:ConfigurationAdds a value extractor. Has priority over any extractor for the same type and type parameter detected through the service loader or given in the XML configuration.- Specified by:
addValueExtractorin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
extractor- value extractor implementation- Returns:
thisfollowing the chaining method pattern.
-
addMapping
Description copied from interface:ConfigurationAdd a stream describing constraint mapping in the Jakarta Bean Validation XML format.The stream should be closed by the client API after the
ValidatorFactoryhas been built. The Jakarta Bean Validation provider must not close the stream.- Specified by:
addMappingin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
stream- XML mapping stream; the given stream should support the mark/reset contract (seeInputStream.markSupported()); if it doesn't, it will be wrapped into a stream supporting the mark/reset contract by the Jakarta Bean Validation provider- Returns:
thisfollowing the chaining method pattern
-
failFast
Description copied from interface:BaseHibernateValidatorConfigurationEn- or disables the fail fast mode. When fail fast is enabled the validation will stop on the first constraint violation detected.- Specified by:
failFastin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
failFast-trueto enable fail fast,falseotherwise.- Returns:
thisfollowing the chaining method pattern
-
allowOverridingMethodAlterParameterConstraint
Description copied from interface:BaseHibernateValidatorConfigurationDefine 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 interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
allow- flag determining whether validation will allow overriding to alter parameter constraints.- Returns:
thisfollowing the chaining method pattern
-
isAllowOverridingMethodAlterParameterConstraint
public boolean isAllowOverridingMethodAlterParameterConstraint() -
allowMultipleCascadedValidationOnReturnValues
Description copied from interface:BaseHibernateValidatorConfigurationDefine 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 interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
allow- flag determining whether validation will allow multiple cascaded validation on return values.- Returns:
thisfollowing the chaining method pattern
-
isAllowMultipleCascadedValidationOnReturnValues
public boolean isAllowMultipleCascadedValidationOnReturnValues() -
allowParallelMethodsDefineParameterConstraints
Description copied from interface:BaseHibernateValidatorConfigurationDefine 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 interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
allow- flag determining whether validation will allow parameter constraints in parallel hierarchies- Returns:
thisfollowing the chaining method pattern
-
scriptEvaluatorFactory
Description copied from interface:BaseHibernateValidatorConfigurationAllows to specify a customScriptEvaluatorFactoryresponsible for creatingScriptEvaluators used to evaluate script expressions forScriptAssertandParameterScriptAssertconstraints.- Specified by:
scriptEvaluatorFactoryin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
scriptEvaluatorFactory- theScriptEvaluatorFactoryto be used- Returns:
thisfollowing the chaining method pattern
-
temporalValidationTolerance
Description copied from interface:BaseHibernateValidatorConfigurationAllows to set the acceptable margin of error when comparing date/time in temporal constraints such asPast/PastOrPresentandFuture/FutureOrPresent.- Specified by:
temporalValidationTolerancein interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
temporalValidationTolerance- the acceptable tolerance- Returns:
thisfollowing the chaining method pattern
-
constraintValidatorPayload
Description copied from interface:BaseHibernateValidatorConfigurationAllows to set a payload which will be passed to the constraint validators. If the method is called multiple times, only the payload passed last will be propagated.- Specified by:
constraintValidatorPayloadin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
constraintValidatorPayload- the payload passed to constraint validators- Returns:
thisfollowing the chaining method pattern
-
getterPropertySelectionStrategy
public T getterPropertySelectionStrategy(GetterPropertySelectionStrategy getterPropertySelectionStrategy) Description copied from interface:BaseHibernateValidatorConfigurationAllows to set a getter property selection strategy defining the rules determining if a method is a getter or not.- Specified by:
getterPropertySelectionStrategyin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
getterPropertySelectionStrategy- theGetterPropertySelectionStrategyto be used- Returns:
thisfollowing the chaining method pattern
-
locales
Description copied from interface:BaseHibernateValidatorConfigurationAllows setting the list of the locales supported by this ValidatorFactory.Can be used for advanced locale resolution and/or to force the initialization of the resource bundles at bootstrap.
If not set, defaults to a singleton containing
Locale.getDefault().- Specified by:
localesin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>
-
defaultLocale
Description copied from interface:BaseHibernateValidatorConfigurationAllows setting the default locale used to interpolate the constraint violation messages.If not set, defaults to the system locale obtained via
Locale.getDefault().- Specified by:
defaultLocalein interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>
-
isAllowParallelMethodsDefineParameterConstraints
public boolean isAllowParallelMethodsDefineParameterConstraints() -
getMethodValidationConfiguration
-
createConstraintMapping
Description copied from interface:BaseHibernateValidatorConfigurationCreates a new constraint mapping which can be used to programmatically configure the constraints for given types. After the mapping has been set up, it must be added to this configuration viaBaseHibernateValidatorConfiguration.addMapping(ConstraintMapping).- Specified by:
createConstraintMappingin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- A new constraint mapping.
-
addMapping
Description copied from interface:BaseHibernateValidatorConfigurationAdds the specifiedConstraintMappinginstance to the configuration. Constraints configured inmappingwill be added to the constraints configured via annotations and/or xml.- Specified by:
addMappingin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
mapping-ConstraintMappinginstance containing programmatic configured constraints- Returns:
thisfollowing the chaining method pattern
-
addProperty
Description copied from interface:ConfigurationAdds a provider specific property. This property is equivalent to XML configuration properties. If the underlying provider does not know how to handle the property, it must silently ignore it.Note: Using this non type-safe method is generally not recommended.
It is more appropriate to use, if available, the type-safe equivalent provided by a specific provider via its
Configurationsubclass.ValidatorFactory factory = Validation.byProvider(ACMEProvider.class) .configure() .providerSpecificProperty(ACMEState.FAST) .buildValidatorFactory();This method is typically used by containers parsingMETA-INF/validation.xmlthemselves and injecting the state to theConfigurationobject.If a property with a given name is defined both via this method and in the XML configuration, the value set programmatically has priority.
If
nullis passed as a value, the value defined in XML is used. If no value is defined in XML, the property is considered unset.- Specified by:
addPropertyin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
name- property namevalue- property value- Returns:
thisfollowing the chaining method pattern
-
externalClassLoader
Description copied from interface:BaseHibernateValidatorConfigurationSets the class loader to be used for loading user-provided resources:- XML descriptors (
META-INF/validation.xmlas well as XML constraint mappings) - classes specified by name in XML descriptors (e.g. custom message interpolators etc.)
- the
ValidationMessagesresource bundle
- Specified by:
externalClassLoaderin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
externalClassLoader- The class loader for loading user-provided resources.- Returns:
thisfollowing the chaining method pattern
- XML descriptors (
-
buildValidatorFactory
Description copied from interface:ConfigurationBuild aValidatorFactoryimplementation.- Specified by:
buildValidatorFactoryin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- the
ValidatorFactory
-
isIgnoreXmlConfiguration
public final boolean isIgnoreXmlConfiguration()Description copied from interface:ConfigurationStateReturnstrueifConfiguration.ignoreXmlConfiguration()has been called.In this case, the
ValidatorFactorymust ignoreMETA-INF/validation.xml.- Specified by:
isIgnoreXmlConfigurationin interfaceConfigurationState- Returns:
trueifMETA-INF/validation.xmlshould be ignored
-
getMessageInterpolator
Description copied from interface:ConfigurationStateReturns the message interpolator of this configuration.Message interpolator is defined in the following decreasing priority:
- set via the
Configurationprogrammatic API - defined in
META-INF/validation.xmlprovided thatignoreXmlConfigurationis false. In this case the instance is created via its no-arg constructor. nullif undefined.
- Specified by:
getMessageInterpolatorin interfaceConfigurationState- Returns:
- message interpolator instance or
nullif not defined
- set via the
-
getMappingStreams
Description copied from interface:ConfigurationStateReturns a set of configuration streams.The streams are defined by:
- mapping XML streams passed programmatically in
Configuration - mapping XML streams located in the resources defined in
META-INF/validation.xml(constraint-mapping element)
Streams represented in the XML configuration and opened by the
Configurationimplementation must be closed by theConfigurationimplementation after theValidatorFactorycreation (or if an exception occurs). All streams are guaranteed to adhere to the mark/reset contract (seeInputStream.markSupported()by the Jakarta Bean Validation provider.- Specified by:
getMappingStreamsin interfaceConfigurationState- Returns:
- set of input stream
- mapping XML streams passed programmatically in
-
getFailFast
public final boolean getFailFast() -
getConstraintValidatorFactory
Description copied from interface:ConfigurationStateReturns the constraint validator factory of this configuration.The
ConstraintValidatorFactoryimplementation is defined in the following decreasing priority:- set via the
Configurationprogrammatic API - defined in
META-INF/validation.xmlprovided thatignoredXmlConfigurationisfalse. In this case the instance is created via its no-arg constructor. nullif undefined.
- Specified by:
getConstraintValidatorFactoryin interfaceConfigurationState- Returns:
- factory instance or
nullif not defined
- set via the
-
getTraversableResolver
Description copied from interface:ConfigurationStateReturns the traversable resolver for this configuration.TraversableResolveris defined in the following decreasing priority:- set via the
Configurationprogrammatic API - defined in
META-INF/validation.xmlprovided thatignoredXmlConfigurationisfalse. In this case the instance is created via its no-arg constructor. nullif undefined.
- Specified by:
getTraversableResolverin interfaceConfigurationState- Returns:
- traversable resolver instance or
nullif not defined
- set via the
-
getBootstrapConfiguration
Description copied from interface:ConfigurationReturns configuration information stored in theMETA-INF/validation.xmlfile.Note:
Implementations are encouraged to lazily build this object to delay parsing.- Specified by:
getBootstrapConfigurationin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- returns an instance of
BootstrapConfiguration; this method never returnsnull; if there is noMETA-INF/validation.xmlthe different getters of the returned instance will returnnullrespectively an empty set or map
-
getParameterNameProvider
Description copied from interface:ConfigurationStateReturns the parameter name provider for this configuration.ParameterNameProvideris defined in the following decreasing priority:- set via the
Configurationprogrammatic API - defined in
META-INF/validation.xmlprovided thatignoreXmlConfigurationisfalse. In this case the instance is created via its no-arg constructor. nullif undefined.
- Specified by:
getParameterNameProviderin interfaceConfigurationState- Returns:
- parameter name provider instance or
nullif not defined
- set via the
-
getClockProvider
Description copied from interface:ConfigurationStateReturns the clock provider for this configuration.ClockProvideris defined in the following decreasing priority:- set via the
Configurationprogrammatic API - defined in
META-INF/validation.xmlprovided thatignoreXmlConfigurationisfalse. In this case the instance is created via its no-arg constructor. nullif undefined.
- Specified by:
getClockProviderin interfaceConfigurationState- Returns:
- clock provider instance or
nullif not defined
- set via the
-
getPropertyNodeNameProvider
-
getLocaleResolver
-
getScriptEvaluatorFactory
-
getTemporalValidationTolerance
-
getConstraintValidatorPayload
-
getGetterPropertySelectionStrategy
-
getValueExtractors
Description copied from interface:ConfigurationStateReturns a set of value extractors.The extractors are retrieved from the following sources in decreasing order:
- extractors passed programmatically to
Configuration - extractors defined in
META-INF/validation.xmlprovided thatignoredXmlConfigurationisfalse - extractors loaded through the Java service loader
META-INF/validation.xmlor loaded through the service loader. Extractors defined inMETA-INF/validation.xmltake precedence over any extractor for the same type and type parameter loaded through the service loader.Extractors defined in
META-INF/validation.xmlor loaded through the service loader are instantiated using their no-arg constructor.- Specified by:
getValueExtractorsin interfaceConfigurationState- Returns:
- set of value extractors; may be empty but never
null
- extractors passed programmatically to
-
getProperties
Description copied from interface:ConfigurationStateReturns a map of non type-safe custom properties.Properties defined via:
Configuration.addProperty(String, String)META-INF/validation.xmlprovided thatignoreXmlConfigurationisfalse.
If a property is defined both programmatically and in XML, the value defined programmatically has priority.
- Specified by:
getPropertiesin interfaceConfigurationState- Returns:
Mapwhose key is the property key and the value the property value
-
getExternalClassLoader
-
getDefaultMessageInterpolator
Description copied from interface:ConfigurationReturns an implementation of theMessageInterpolatorinterface following the defaultMessageInterpolatordefined in the specification:- use the
ValidationMessagesresource bundle to load keys - use
Locale.getDefault()
- Specified by:
getDefaultMessageInterpolatorin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- default
MessageInterpolatorimplementation compliant with the specification
- use the
-
getDefaultTraversableResolver
Description copied from interface:ConfigurationReturns an implementation of theTraversableResolverinterface following the defaultTraversableResolverdefined in the specification:- if Java Persistence is available in the runtime environment, a property is considered reachable if Java Persistence considers the property as loaded
- if Java Persistence is not available in the runtime environment, all properties are considered reachable
- all properties are considered cascadable.
- Specified by:
getDefaultTraversableResolverin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- default
TraversableResolverimplementation compliant with the specification
-
getDefaultConstraintValidatorFactory
Description copied from interface:ConfigurationReturns an implementation of theConstraintValidatorFactoryinterface following the defaultConstraintValidatorFactorydefined in the specification:- uses the public no-arg constructor of the
ConstraintValidator
- Specified by:
getDefaultConstraintValidatorFactoryin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- default
ConstraintValidatorFactoryimplementation compliant with the specification
- uses the public no-arg constructor of the
-
getDefaultResourceBundleLocator
Description copied from interface:BaseHibernateValidatorConfigurationReturns the
ResourceBundleLocatorused by thedefault message interpolatorto load user-provided resource bundles. In conformance with the specification this default locator retrieves the bundle "ValidationMessages".This locator can be used as delegate for custom locators when setting a customized
ResourceBundleMessageInterpolator:HibernateValidatorConfiguration configure = Validation.byProvider(HibernateValidator.class).configure(); ResourceBundleLocator defaultResourceBundleLocator = configure.getDefaultBundleLocator(); ResourceBundleLocator myResourceBundleLocator = new MyResourceBundleLocator(defaultResourceBundleLocator); configure.messageInterpolator( new ResourceBundleMessageInterpolator(myResourceBundleLocator));- Specified by:
getDefaultResourceBundleLocatorin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- The default
ResourceBundleLocator. Never null.
-
getDefaultParameterNameProvider
Description copied from interface:ConfigurationReturns an implementation of theParameterNameProviderinterface following the defaultParameterNameProviderdefined in the specification:- returns the actual parameter names as provided in the validated executable’s definition, if the class file of the executable contains parameter name information
-
otherwise returns names in the form
arg<PARAMETER_INDEX>, wherePARAMETER_INDEXstarts at 0 for the first parameter, e.g.arg0,arg1etc.
- Specified by:
getDefaultParameterNameProviderin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- default
ParameterNameProviderimplementation compliant with the specification
-
getDefaultClockProvider
Description copied from interface:ConfigurationReturns an implementation of theClockProviderinterface following the defaultClockProviderdefined in the specification:- returns a clock representing the current system time and default time zone.
- Specified by:
getDefaultClockProviderin interfaceConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- default
ClockProviderimplementation compliant with the specification
-
getDefaultValueExtractors
Description copied from interface:BaseHibernateValidatorConfigurationReturns the defaultValueExtractorimplementations as per the specification.- Specified by:
getDefaultValueExtractorsin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Returns:
- the default
ValueExtractorimplementations compliant with the specification
-
beanMetaDataClassNormalizer
- Specified by:
beanMetaDataClassNormalizerin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>
-
getBeanMetaDataClassNormalizer
-
constraintExpressionLanguageFeatureLevel
public T constraintExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel) Description copied from interface:BaseHibernateValidatorConfigurationAllows setting the Expression Language feature level for message interpolation of constraint messages.This is the feature level used for messages hardcoded inside the constraint declaration.
If you are creating custom constraint violations, Expression Language support needs to be explicitly enabled and use the safest feature level by default if enabled.
- Specified by:
constraintExpressionLanguageFeatureLevelin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
expressionLanguageFeatureLevel- theExpressionLanguageFeatureLevelto be used- Returns:
thisfollowing the chaining method pattern
-
getConstraintExpressionLanguageFeatureLevel
-
customViolationExpressionLanguageFeatureLevel
public T customViolationExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel) Description copied from interface:BaseHibernateValidatorConfigurationAllows setting the Expression Language feature level for message interpolation of custom violation messages.This is the feature level used for messages of custom violations created by the
ConstraintValidatorContext.- Specified by:
customViolationExpressionLanguageFeatureLevelin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
expressionLanguageFeatureLevel- theExpressionLanguageFeatureLevelto be used- Returns:
thisfollowing the chaining method pattern
-
getCustomViolationExpressionLanguageFeatureLevel
-
showValidatedValuesInTraceLogs
Description copied from interface:BaseHibernateValidatorConfigurationAllows setting the logging configuration that would include validated values in trace level logs.By default, values will not be printed to the logs as they might contain sensitive data.
- Specified by:
showValidatedValuesInTraceLogsin interfaceBaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>- Parameters:
enabled- flag determining whether validated values will be printed out into trace level logs or not.- Returns:
thisfollowing the chaining method pattern
-
getShowValidatedValuesInTraceLogs
public final boolean getShowValidatedValuesInTraceLogs() -
getProgrammaticMappings
-
preloadResourceBundles
protected abstract boolean preloadResourceBundles() -
thisAsT
-