Top Description Fields Constructors Methods
org.hibernate.validator.internal.engine

public abstract Class AbstractConfigurationImpl<T extends org.hibernate.validator.BaseHibernateValidatorConfiguration<T>>

extends Object
implements BaseHibernateValidatorConfiguration<T extends BaseHibernateValidatorConfiguration<T>>, ConfigurationState
Class Inheritance
All Implemented Interfaces
jakarta.validation.spi.ConfigurationState, org.hibernate.validator.BaseHibernateValidatorConfiguration, jakarta.validation.Configuration
Known Direct Subclasses
org.hibernate.validator.internal.engine.ConfigurationImpl, org.hibernate.validator.internal.engine.PredefinedScopeConfigurationImpl
Static Imports
org.hibernate.validator.internal.util.CollectionHelper.newHashSet, org.hibernate.validator.internal.util.logging.Messages.MESSAGES

Hibernate specific Configuration implementation.
Authors
Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Kevin Pollet <[email protected]> (C) 2011 SERLI, Chris Beckey <[email protected]>, Guillaume Smet

Field Summary

Modifier and TypeField and Description
private BeanMetaDataClassNormalizer
private BootstrapConfiguration
private final Set<InputStream>
private ExpressionLanguageFeatureLevel
private Object
private ExpressionLanguageFeatureLevel
private final ClockProvider
private final ConstraintValidatorFactory
private Locale
private MessageInterpolator
private final ParameterNameProvider
private final PropertyNodeNameProvider
private ResourceBundleLocator
defaultResourceBundleLocator

Built lazily so RBMI and its dependency on EL is only initialized if actually needed

private TraversableResolver
defaultTraversableResolver

Created lazily to avoid fishing in the classpath if one has been defined.

private ClassLoader
private boolean
private GetterPropertySelectionStrategy
private boolean
private LocaleResolver
private Set<Locale>
private static final Log
private MessageInterpolator
private final MethodValidationConfiguration.Builder
private final Set<DefaultConstraintMapping>
private ValidationProviderResolver
private ScriptEvaluatorFactory
private boolean
private Duration
private boolean
private final ValidationBootstrapParameters
private final Map<ValueExtractorDescriptor.Key, ValueExtractorDescriptor>

Constructor Summary

AccessConstructor and Description
protected
protected
private

Method Summary

Modifier and TypeMethod and Description
public final T
addMapping(InputStream
XML mapping stream; the given stream should support the mark/reset contract (see InputStream#markSupported()); if it doesn't, it will be wrapped into a stream supporting the mark/reset contract by the Jakarta Bean Validation provider
stream
)

Implements jakarta.validation.Configuration.addMapping.

Add a stream describing constraint mapping in the Jakarta Bean Validation XML format.
public final T
addMapping(ConstraintMapping
ConstraintMapping instance containing programmatic configured constraints
mapping
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.addMapping.

Adds the specified ConstraintMapping instance to the configuration.
public final T
addProperty(String
property name
name
,
String
property value
value
)

Implements jakarta.validation.Configuration.addProperty.

Adds a provider specific property.
public T
addValueExtractor(ValueExtractor<?>
value extractor implementation
extractor
)

Implements jakarta.validation.Configuration.addValueExtractor.

Adds a value extractor.
public T
allowMultipleCascadedValidationOnReturnValues(boolean
flag determining whether validation will allow multiple cascaded validation on return values.
allow
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.allowMultipleCascadedValidationOnReturnValues.

Define whether more than one constraint on a return value may be marked for cascading validation are allowed.
public T
allowOverridingMethodAlterParameterConstraint(boolean
flag determining whether validation will allow overriding to alter parameter constraints.
allow
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.allowOverridingMethodAlterParameterConstraint.

Define whether overriding methods that override constraints should throw a ConstraintDefinitionException.
public T
allowParallelMethodsDefineParameterConstraints(boolean
flag determining whether validation will allow parameter constraints in parallel hierarchies
allow
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.allowParallelMethodsDefineParameterConstraints.

Define whether parallel methods that define constraints should throw a ConstraintDefinitionException.
private void
public T
public final ValidatorFactory
public T
clockProvider(ClockProvider
clock provider implementation
clockProvider
)

Implements jakarta.validation.Configuration.clockProvider.

Defines the clock provider.
public T
constraintExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.constraintExpressionLanguageFeatureLevel.

Allows setting the Expression Language feature level for message interpolation of constraint messages.
public final T
constraintValidatorFactory(ConstraintValidatorFactory
constraint factory implementation
constraintValidatorFactory
)

Implements jakarta.validation.Configuration.constraintValidatorFactory.

Defines the constraint validator factory.
public T
constraintValidatorPayload(Object
the payload passed to constraint validators
constraintValidatorPayload
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.constraintValidatorPayload.

Allows to set a payload which will be passed to the constraint validators.
public final DefaultConstraintMapping
createConstraintMapping()

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.createConstraintMapping.

Creates a new constraint mapping which can be used to programmatically configure the constraints for given types.
public T
customViolationExpressionLanguageFeatureLevel(ExpressionLanguageFeatureLevel expressionLanguageFeatureLevel)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.customViolationExpressionLanguageFeatureLevel.

Allows setting the Expression Language feature level for message interpolation of custom violation messages.
public T
defaultLocale(Locale defaultLocale)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.defaultLocale.

Allows setting the default locale used to interpolate the constraint violation messages.
public final T
enableTraversableResolverResultCache(boolean
flag determining whether per validation call caching is enabled for TraversableResolver results.
enabled
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.enableTraversableResolverResultCache.

Define whether the per validation call caching of TraversableResolver results is enabled.
public T
externalClassLoader(ClassLoader
The class loader for loading user-provided resources.
externalClassLoader
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.externalClassLoader.

Sets the class loader to be used for loading user-provided resources:
  • XML descriptors (META-INF/validation.xml as well as XML constraint mappings)
  • classes specified by name in XML descriptors (e.g. custom message interpolators etc.)
  • the ValidationMessages resource bundle
public final T
failFast(boolean
true to enable fail fast, false otherwise.
failFast
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.failFast.

En- or disables the fail fast mode.
private Set<Locale>
public BeanMetaDataClassNormalizer
public BootstrapConfiguration
getBootstrapConfiguration()

Implements jakarta.validation.Configuration.getBootstrapConfiguration.

Returns configuration information stored in the META-INF/validation.xml file.
public ClockProvider
getClockProvider()

Implements jakarta.validation.spi.ConfigurationState.getClockProvider.

Returns the clock provider for this configuration.
public ExpressionLanguageFeatureLevel
public final ConstraintValidatorFactory
getConstraintValidatorFactory()

Implements jakarta.validation.spi.ConfigurationState.getConstraintValidatorFactory.

Returns the constraint validator factory of this configuration.
public Object
public ExpressionLanguageFeatureLevel
public ClockProvider
getDefaultClockProvider()

Implements jakarta.validation.Configuration.getDefaultClockProvider.

Returns an implementation of the ClockProvider interface following the default ClockProvider defined in the specification:
  • returns a clock representing the current system time and default time zone.
public final ConstraintValidatorFactory
getDefaultConstraintValidatorFactory()

Implements jakarta.validation.Configuration.getDefaultConstraintValidatorFactory.

Returns an implementation of the ConstraintValidatorFactory interface following the default ConstraintValidatorFactory defined in the specification:
public final MessageInterpolator
getDefaultMessageInterpolator()

Implements jakarta.validation.Configuration.getDefaultMessageInterpolator.

Returns an implementation of the MessageInterpolator interface following the default MessageInterpolator defined in the specification:
  • use the ValidationMessages resource bundle to load keys
  • use Locale.getDefault()
private MessageInterpolator
getDefaultMessageInterpolatorConfiguredWithClassLoader()

Returns the default message interpolator, configured with the given user class loader, if present.

public ParameterNameProvider
getDefaultParameterNameProvider()

Implements jakarta.validation.Configuration.getDefaultParameterNameProvider.

Returns an implementation of the ParameterNameProvider interface following the default ParameterNameProvider defined 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>, where PARAMETER_INDEX starts at 0 for the first parameter, e.g. arg0, arg1 etc.
public final ResourceBundleLocator
public final TraversableResolver
getDefaultTraversableResolver()

Implements jakarta.validation.Configuration.getDefaultTraversableResolver.

Returns an implementation of the TraversableResolver interface following the default TraversableResolver defined 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.
public Set<ValueExtractor<?>>
public ClassLoader
public final boolean
public GetterPropertySelectionStrategy
public LocaleResolver
public final Set<InputStream>
getMappingStreams()

Implements jakarta.validation.spi.ConfigurationState.getMappingStreams.

Returns a set of configuration streams.
public final MessageInterpolator
getMessageInterpolator()

Implements jakarta.validation.spi.ConfigurationState.getMessageInterpolator.

Returns the message interpolator of this configuration.
public MethodValidationConfiguration
public ParameterNameProvider
getParameterNameProvider()

Implements jakarta.validation.spi.ConfigurationState.getParameterNameProvider.

Returns the parameter name provider for this configuration.
public final Set<DefaultConstraintMapping>
public final Map<String, String>
getProperties()

Implements jakarta.validation.spi.ConfigurationState.getProperties.

Returns a map of non type-safe custom properties.
public PropertyNodeNameProvider
public ScriptEvaluatorFactory
public final boolean
public Duration
public T
getterPropertySelectionStrategy(GetterPropertySelectionStrategy getterPropertySelectionStrategy)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.getterPropertySelectionStrategy.

Allows to set a getter property selection strategy defining the rules determining if a method is a getter or not.
public final TraversableResolver
getTraversableResolver()

Implements jakarta.validation.spi.ConfigurationState.getTraversableResolver.

Returns the traversable resolver for this configuration.
public Set<ValueExtractor<?>>
public final T
ignoreXmlConfiguration()

Implements jakarta.validation.Configuration.ignoreXmlConfiguration.

Ignores data from the META-INF/validation.xml file if this method is called.
public boolean
public boolean
public boolean
public final boolean
private boolean
public final boolean
private void
public T
localeResolver(LocaleResolver
the LocaleResolver to be used
localeResolver
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.localeResolver.

Allows setting a locale resolver, defining how the locale will be resolved when interpolating the message of a constraint violation.
public T
locales(Set<Locale> locales)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.locales.

Allows setting the list of the locales supported by this ValidatorFactory.
public final T
messageInterpolator(MessageInterpolator
message interpolator implementation
interpolator
)

Implements jakarta.validation.Configuration.messageInterpolator.

Defines the message interpolator used.
public T
parameterNameProvider(ParameterNameProvider
parameter name provider implementation
parameterNameProvider
)

Implements jakarta.validation.Configuration.parameterNameProvider.

Defines the parameter name provider.
private void
parseValidationXml()

Tries to check whether a validation.xml file exists and parses it

protected abstract boolean
public T
propertyNodeNameProvider(PropertyNodeNameProvider propertyNodeNameProvider)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.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 by ConstraintViolation#getPropertyPath().
private static <T> T
run(PrivilegedAction<T> action)

Runs the given privileged action, using a privileged block if required.

public T
scriptEvaluatorFactory(ScriptEvaluatorFactory
the ScriptEvaluatorFactory to be used
scriptEvaluatorFactory
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.scriptEvaluatorFactory.

Allows to specify a custom ScriptEvaluatorFactory responsible for creating ScriptEvaluators used to evaluate script expressions for ScriptAssert and ParameterScriptAssert constraints.
public T
showValidatedValuesInTraceLogs(boolean
flag determining whether validated values will be printed out into trace level logs or not.
enabled
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.showValidatedValuesInTraceLogs.

Allows setting the logging configuration that would include validated values in trace level logs.
public T
temporalValidationTolerance(Duration
the acceptable tolerance
temporalValidationTolerance
)

Implements org.hibernate.validator.BaseHibernateValidatorConfiguration.temporalValidationTolerance.

Allows to set the acceptable margin of error when comparing date/time in temporal constraints such as Past/PastOrPresent and Future/FutureOrPresent.
protected T
public final T
traversableResolver(TraversableResolver
traversable resolver implementation
resolver
)

Implements jakarta.validation.Configuration.traversableResolver.

Defines the traversable resolver used.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait