Top Description Methods
jakarta.validation.spi

public Interface ConfigurationState

Imports
java.io.InputStream, java.util.Map, .Set, jakarta.validation.ClockProvider, .Configuration, .ConstraintValidatorFactory, .MessageInterpolator, .ParameterNameProvider, .TraversableResolver, .ValidatorFactory, jakarta.validation.valueextraction.ValueExtractor

Contract between a Configuration and a ValidationProvider to create a ValidatorFactory.

The configuration artifacts defined in the XML configuration and provided to the Configuration are merged and passed along via ConfigurationState.

Authors
Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Guillaume Smet

Method Summary

Modifier and TypeMethod and Description
public ClockProvider

Returns:

clock provider instance or null if not defined
getClockProvider
()

Returns the clock provider for this configuration.

public ConstraintValidatorFactory

Returns:

factory instance or null if not defined
getConstraintValidatorFactory
()

Returns the constraint validator factory of this configuration.

public Set<InputStream>

Returns:

set of input stream
getMappingStreams
()

Returns a set of configuration streams.

public MessageInterpolator

Returns:

message interpolator instance or null if not defined
getMessageInterpolator
()

Returns the message interpolator of this configuration.

public ParameterNameProvider

Returns:

parameter name provider instance or null if not defined
getParameterNameProvider
()

Returns the parameter name provider for this configuration.

public Map<String, String>

Returns:

Map whose key is the property key and the value the property value
getProperties
()

Returns a map of non type-safe custom properties.

public TraversableResolver

Returns:

traversable resolver instance or null if not defined
getTraversableResolver
()

Returns the traversable resolver for this configuration.

public Set<ValueExtractor<?>>

Returns:

set of value extractors; may be empty but never null
getValueExtractors
()

Returns a set of value extractors.

public boolean

Returns:

true if META-INF/validation.xml should be ignored
isIgnoreXmlConfiguration
()

Returns true if Configuration#ignoreXmlConfiguration() has been called.

Method Detail

getClockProviderback to summary
public ClockProvider getClockProvider()

Returns the clock provider for this configuration.

ClockProvider is defined in the following decreasing priority:

  • set via the Configuration programmatic API
  • defined in META-INF/validation.xml provided that ignoreXmlConfiguration is false. In this case the instance is created via its no-arg constructor.
  • null if undefined.
Returns:ClockProvider

clock provider instance or null if not defined

Since
2.0
getConstraintValidatorFactoryback to summary
public ConstraintValidatorFactory getConstraintValidatorFactory()

Returns the constraint validator factory of this configuration.

The ConstraintValidatorFactory implementation is defined in the following decreasing priority:

  • set via the Configuration programmatic API
  • defined in META-INF/validation.xml provided that ignoredXmlConfiguration is false. In this case the instance is created via its no-arg constructor.
  • null if undefined.
Returns:ConstraintValidatorFactory

factory instance or null if not defined

getMappingStreamsback to summary
public Set<InputStream> getMappingStreams()

Returns 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 Configuration implementation must be closed by the Configuration implementation after the ValidatorFactory creation (or if an exception occurs). All streams are guaranteed to adhere to the mark/reset contract (see InputStream#markSupported() by the Jakarta Validation provider.

Returns:Set<InputStream>

set of input stream

getMessageInterpolatorback to summary
public MessageInterpolator getMessageInterpolator()

Returns the message interpolator of this configuration.

Message interpolator is defined in the following decreasing priority:

  • set via the Configuration programmatic API
  • defined in META-INF/validation.xml provided that ignoreXmlConfiguration is false. In this case the instance is created via its no-arg constructor.
  • null if undefined.
Returns:MessageInterpolator

message interpolator instance or null if not defined

getParameterNameProviderback to summary
public ParameterNameProvider getParameterNameProvider()

Returns the parameter name provider for this configuration.

ParameterNameProvider is defined in the following decreasing priority:

  • set via the Configuration programmatic API
  • defined in META-INF/validation.xml provided that ignoreXmlConfiguration is false. In this case the instance is created via its no-arg constructor.
  • null if undefined.
Returns:ParameterNameProvider

parameter name provider instance or null if not defined

Since
1.1
getPropertiesback to summary
public Map<String, String> getProperties()

Returns a map of non type-safe custom properties.

Properties defined via:

If a property is defined both programmatically and in XML, the value defined programmatically has priority.

Returns:Map<String, String>

Map whose key is the property key and the value the property value

getTraversableResolverback to summary
public TraversableResolver getTraversableResolver()

Returns the traversable resolver for this configuration.

TraversableResolver is defined in the following decreasing priority:

  • set via the Configuration programmatic API
  • defined in META-INF/validation.xml provided that ignoredXmlConfiguration is false. In this case the instance is created via its no-arg constructor.
  • null if undefined.
Returns:TraversableResolver

traversable resolver instance or null if not defined

getValueExtractorsback to summary
public Set<ValueExtractor<?>> getValueExtractors()

Returns 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.xml provided that ignoredXmlConfiguration is false
  • extractors loaded through the Java service loader
An extractor for a given type and type parameter passed in programmatically takes precedence over any extractor for the same type and type parameter defined in META-INF/validation.xml or loaded through the service loader. Extractors defined in META-INF/validation.xml take precedence over any extractor for the same type and type parameter loaded through the service loader.

Extractors defined in META-INF/validation.xml or loaded through the service loader are instantiated using their no-arg constructor.

Returns:Set<ValueExtractor<?>>

set of value extractors; may be empty but never null

Since
2.0
isIgnoreXmlConfigurationback to summary
public boolean isIgnoreXmlConfiguration()

Returns true if Configuration#ignoreXmlConfiguration() has been called.

In this case, the ValidatorFactory must ignore META-INF/validation.xml.

Returns:boolean

true if META-INF/validation.xml should be ignored