public interface HibernateValidatorConfiguration extends Configuration<HibernateValidatorConfiguration>
Modifier and Type | Field and Description |
---|---|
static String |
CONSTRAINT_DEFINITION_CONTRIBUTORS
Property corresponding to the
addConstraintDefinitionContributor(org.hibernate.validator.spi.constraintdefinition.ConstraintDefinitionContributor)
method. |
static String |
CONSTRAINT_MAPPING_CONTRIBUTOR
Property for configuring a constraint mapping contributor, allowing to set up one or more constraint mappings for
the default validator factory.
|
static String |
FAIL_FAST
Property corresponding to the
failFast(boolean) method. |
static String |
TIME_PROVIDER |
static String |
VALIDATED_VALUE_HANDLERS
Property corresponding to the
addValidatedValueHandler(ValidatedValueUnwrapper) method. |
Modifier and Type | Method and Description |
---|---|
HibernateValidatorConfiguration |
addConstraintDefinitionContributor(ConstraintDefinitionContributor contributor)
Registers the given
ConstraintDefinitionContributor with the bootstrapped validator factory. |
HibernateValidatorConfiguration |
addMapping(ConstraintMapping mapping)
Adds the specified
ConstraintMapping instance to the configuration. |
HibernateValidatorConfiguration |
addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)
Registers the given validated value unwrapper with the bootstrapped validator factory.
|
ConstraintMapping |
createConstraintMapping()
Creates a new constraint mapping which can be used to programmatically configure the constraints for given types.
|
HibernateValidatorConfiguration |
externalClassLoader(ClassLoader 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. |
HibernateValidatorConfiguration |
failFast(boolean failFast)
En- or disables the fail fast mode.
|
ConstraintDefinitionContributor |
getDefaultConstraintDefinitionContributor() |
ResourceBundleLocator |
getDefaultResourceBundleLocator()
Returns the
ResourceBundleLocator used by the
default message
interpolator to load user-provided resource bundles. |
HibernateValidatorConfiguration |
timeProvider(TimeProvider timeProvider)
Registers the given time provider with the bootstrapped validator factory.
|
addMapping, addProperty, buildValidatorFactory, constraintValidatorFactory, getBootstrapConfiguration, getDefaultConstraintValidatorFactory, getDefaultMessageInterpolator, getDefaultParameterNameProvider, getDefaultTraversableResolver, ignoreXmlConfiguration, messageInterpolator, parameterNameProvider, traversableResolver
static final String FAIL_FAST
static final String VALIDATED_VALUE_HANDLERS
addValidatedValueHandler(ValidatedValueUnwrapper)
method. Accepts a String
with the comma-separated fully-qualified names of one or more ValidatedValueUnwrapper
implementations.static final String CONSTRAINT_DEFINITION_CONTRIBUTORS
addConstraintDefinitionContributor(org.hibernate.validator.spi.constraintdefinition.ConstraintDefinitionContributor)
method. Accepts a String with the comma-separated fully-qualified names of one or more ConstraintDefinitionContributor
implementations.static final String CONSTRAINT_MAPPING_CONTRIBUTOR
ConstraintMappingContributor
implementation.static final String TIME_PROVIDER
ResourceBundleLocator getDefaultResourceBundleLocator()
Returns the ResourceBundleLocator
used by the
default message
interpolator
to 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));
ResourceBundleLocator
. Never null.ConstraintMapping createConstraintMapping()
addMapping(ConstraintMapping)
.HibernateValidatorConfiguration addMapping(ConstraintMapping mapping)
ConstraintMapping
instance to the configuration. Constraints configured in mapping
will be added to the constraints configured via annotations and/or xml.mapping
- ConstraintMapping
instance containing programmatic configured constraintsthis
following the chaining method patternIllegalArgumentException
- if mapping
is null
HibernateValidatorConfiguration failFast(boolean failFast)
failFast
- true
to enable fail fast, false
otherwise.this
following the chaining method patternHibernateValidatorConfiguration addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)
UnwrapValidatedValue
, the unwrapper will be applied to retrieve the
value to validate.handler
- the unwrapper to registerthis
following the chaining method patternConstraintDefinitionContributor getDefaultConstraintDefinitionContributor()
ConstraintDefinitionContributor
. Never null
.HibernateValidatorConfiguration addConstraintDefinitionContributor(ConstraintDefinitionContributor contributor)
ConstraintDefinitionContributor
with the bootstrapped validator factory.contributor
- the ConstraintDefinitionContributor
to register. Cannot be null
.this
following the chaining method patternHibernateValidatorConfiguration externalClassLoader(ClassLoader externalClassLoader)
META-INF/validation.xml
as well as XML constraint mappings)ValidationMessages
resource bundleexternalClassLoader
- The class loader for loading user-provided resources.this
following the chaining method patternHibernateValidatorConfiguration timeProvider(TimeProvider timeProvider)
@Future
and @Past
constraints. By default the current system
time and the current default time zone will be used when validating these constraints.timeProvider
- the time provider to register. Must not be null
this
following the chaining method patternCopyright © 2007-2017 Red Hat, Inc. All Rights Reserved