Top Description Methods
jakarta.validation

public Interface ValidatorFactory

extends AutoCloseable

Factory returning initialized Validator instances.

Implementations are thread-safe and instances are typically cached and reused.

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

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes the ValidatorFactory instance.
public ClockProvider

Returns:

ClockProvider instance
getClockProvider
()

Returns the ClockProvider instance configured at initialization time for the ValidatorFactory.

public ConstraintValidatorFactory

Returns:

ConstraintValidatorFactory instance
getConstraintValidatorFactory
()

Returns the ConstraintValidatorFactory instance configured at initialization time for the ValidatorFactory.

public MessageInterpolator

Returns:

MessageInterpolator instance
getMessageInterpolator
()

Returns the MessageInterpolator instance configured at initialization time for the ValidatorFactory.

public ParameterNameProvider

Returns:

ParameterNameProvider instance
getParameterNameProvider
()

Returns the ParameterNameProvider instance configured at initialization time for the ValidatorFactory.

public TraversableResolver

Returns:

TraversableResolver instance
getTraversableResolver
()

Returns the TraversableResolver instance configured at initialization time for the ValidatorFactory.

public Validator

Returns:

an initialized Validator instance
getValidator
()

Returns an initialized Validator instance using the factory defaults for message interpolator, traversable resolver and constraint validator factory.

public <
the type of the object to be returned
T
>
T

Returns:

an instance of the specified class
unwrap
(Class<T>
the class of the object to be returned
type
)

Returns an instance of the specified type allowing access to provider-specific APIs.

public ValidatorContext

Returns:

a ValidatorContext instance
usingContext
()

Defines a new validator context and returns a Validator compliant this new context.

Method Detail

closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Closes the ValidatorFactory instance. After the ValidatorFactory instance is closed, calling the following methods is not allowed:

  • methods of this ValidatorFactory instance
  • methods of Validator instances created by this ValidatorFactory
Annotations
@Override
Since
1.1
getClockProviderback to summary
public ClockProvider getClockProvider()

Returns the ClockProvider instance configured at initialization time for the ValidatorFactory. This is the instance used by #getValidator().

Returns:ClockProvider

ClockProvider instance

Since
2.0
getConstraintValidatorFactoryback to summary
public ConstraintValidatorFactory getConstraintValidatorFactory()

Returns the ConstraintValidatorFactory instance configured at initialization time for the ValidatorFactory. This is the instance used by getValidator().

Returns:ConstraintValidatorFactory

ConstraintValidatorFactory instance

getMessageInterpolatorback to summary
public MessageInterpolator getMessageInterpolator()

Returns the MessageInterpolator instance configured at initialization time for the ValidatorFactory. This is the instance used by getValidator().

Returns:MessageInterpolator

MessageInterpolator instance

getParameterNameProviderback to summary
public ParameterNameProvider getParameterNameProvider()

Returns the ParameterNameProvider instance configured at initialization time for the ValidatorFactory. This is the instance used by #getValidator().

Returns:ParameterNameProvider

ParameterNameProvider instance

Since
1.1
getTraversableResolverback to summary
public TraversableResolver getTraversableResolver()

Returns the TraversableResolver instance configured at initialization time for the ValidatorFactory. This is the instance used by getValidator().

Returns:TraversableResolver

TraversableResolver instance

getValidatorback to summary
public Validator getValidator()

Returns an initialized Validator instance using the factory defaults for message interpolator, traversable resolver and constraint validator factory.

Validator instances can be pooled and shared by the implementation.

Returns:Validator

an initialized Validator instance

unwrapback to summary
public <T> T unwrap(Class<T> type)

Returns an instance of the specified type allowing access to provider-specific APIs. If the Jakarta Bean Validation provider implementation does not support the specified class, a ValidationException is thrown.

Parameters
<T>
the type of the object to be returned
type:Class<T>

the class of the object to be returned

Returns:T

an instance of the specified class

Exceptions
ValidationException:
if the provider does not support the call.
usingContextback to summary
public ValidatorContext usingContext()

Defines a new validator context and returns a Validator compliant this new context.

Returns:ValidatorContext

a ValidatorContext instance