ValidatorFactory.
Usage:
//provided by one of the Validation bootstrap methods
Configuration<?> configuration =
ValidatorFactory = configuration
.messageInterpolator( new CustomMessageInterpolator() )
.buildValidatorFactory();
By default, the configuration information is retrieved from
META-INF/validation.xml.
It is possible to override the configuration retrieved from the XML file
by using one or more of the Configuration methods.
The ValidationProviderResolver is specified at configuration time
(see ValidationProvider).
If none is explicitly requested, the default ValidationProviderResolver is used.
The provider is selected in the following way:
Validation#byProvider(Class), find the first provider implementing
the provider class requested and use itMETA-INF/validation.xml,
find the first provider implementing the provider class requested and use itValidationProviderResolverImplementations are not meant to be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
| public T | Returns: this following the chaining method patternXML mapping stream; the given stream should support the
mark/reset contract (see stream)InputStream#markSupported());
if it doesn't, it will be wrapped into a stream supporting the
mark/reset contract by the Jakarta Validation providerAdd a stream describing constraint mapping in the Jakarta Validation XML format. |
| public T | Returns: this following the chaining method patternproperty name name, String property value value)Adds a provider specific property. |
| public T | Returns: this following the chaining method pattern.value extractor implementation extractor)Adds a value extractor. |
| public ValidatorFactory | |
| public T | Returns: this following the chaining method pattern.clock provider implementation clockProvider)Defines the clock provider. |
| public T | Returns: this following the chaining method patternconstraint factory implementation constraintValidatorFactory)Defines the constraint validator factory. |
| public BootstrapConfiguration | Returns: returns an instance ofBootstrapConfiguration; this method never
returns null; if there is no META-INF/validation.xml the
different getters of the returned instance will return null
respectively an empty set or mapReturns configuration information stored in the |
| public ClockProvider | Returns: defaultClockProvider implementation compliant with
the specificationReturns an implementation of the
|
| public ConstraintValidatorFactory | Returns: defaultConstraintValidatorFactory implementation compliant with the
specificationReturns an implementation of the Specification
|
| public MessageInterpolator | Returns: defaultMessageInterpolator implementation compliant with the
specificationReturns an implementation of the
|
| public ParameterNameProvider | Returns: defaultParameterNameProvider implementation compliant with
the specificationReturns an implementation of the
|
| public TraversableResolver | Returns: defaultTraversableResolver implementation compliant with the
specificationReturns an implementation of the
|
| public T | Returns: this following the chaining method pattern.Ignores data from the |
| public T | Returns: this following the chaining method patternmessage interpolator implementation interpolator)Defines the message interpolator used. |
| public T | Returns: this following the chaining method pattern.parameter name provider implementation parameterNameProvider)Defines the parameter name provider. |
| public T | Returns: this following the chaining method patterntraversable resolver implementation resolver)Defines the traversable resolver used. |
| addMapping | back to summary |
|---|---|
| public T addMapping(InputStream stream) Add a stream describing constraint mapping in the Jakarta Validation XML format.
The stream should be closed by the client API after the
| |
| addProperty | back to summary |
|---|---|
| public T addProperty(String name, String value) Adds 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
ValidatorFactory factory = Validation.byProvider(ACMEProvider.class)
.configure()
.providerSpecificProperty(ACMEState.FAST)
.buildValidatorFactory();
This method is typically used by containers parsing META-INF/validation.xml
themselves and injecting the state to the Configuration object.
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
| |
| addValueExtractor | back to summary |
|---|---|
| public T addValueExtractor(ValueExtractor<?> extractor) Adds 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.
| |
| buildValidatorFactory | back to summary |
|---|---|
| public ValidatorFactory buildValidatorFactory() Build a
| |
| clockProvider | back to summary |
|---|---|
| public T clockProvider(ClockProvider clockProvider) Defines the clock provider. Has priority over the configuration based provider.
If
| |
| constraintValidatorFactory | back to summary |
|---|---|
| public T constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) Defines the constraint validator factory. Has priority over the configuration based constraint factory.
If
| |
| getBootstrapConfiguration | back to summary |
|---|---|
| public BootstrapConfiguration getBootstrapConfiguration() Returns configuration information stored in the Note Implementations are encouraged to lazily build this object to delay parsing.
| |
| getDefaultClockProvider | back to summary |
|---|---|
| public ClockProvider getDefaultClockProvider() Returns an implementation of the
| |
| getDefaultConstraintValidatorFactory | back to summary |
|---|---|
| public ConstraintValidatorFactory getDefaultConstraintValidatorFactory() Returns an implementation of the Specification
| |
| getDefaultMessageInterpolator | back to summary |
|---|---|
| public MessageInterpolator getDefaultMessageInterpolator() Returns an implementation of the
| |
| getDefaultParameterNameProvider | back to summary |
|---|---|
| public ParameterNameProvider getDefaultParameterNameProvider() Returns an implementation of the
| |
| getDefaultTraversableResolver | back to summary |
|---|---|
| public TraversableResolver getDefaultTraversableResolver() Returns an implementation of the
| |
| ignoreXmlConfiguration | back to summary |
|---|---|
| public T ignoreXmlConfiguration() Ignores data from the
This method is typically useful for containers that parse
| |
| messageInterpolator | back to summary |
|---|---|
| public T messageInterpolator(MessageInterpolator interpolator) Defines the message interpolator used. Has priority over the configuration based message interpolator.
If
| |
| parameterNameProvider | back to summary |
|---|---|
| public T parameterNameProvider(ParameterNameProvider parameterNameProvider) Defines the parameter name provider. Has priority over the configuration based provider.
If
| |
| traversableResolver | back to summary |
|---|---|
| public T traversableResolver(TraversableResolver resolver) Defines the traversable resolver used. Has priority over the configuration based traversable resolver.
If
| |