Class ValidatorFactoryImpl
- java.lang.Object
-
- org.hibernate.validator.internal.engine.ValidatorFactoryImpl
-
- All Implemented Interfaces:
ValidatorFactory,AutoCloseable,HibernateValidatorFactory
public class ValidatorFactoryImpl extends Object implements HibernateValidatorFactory
Factory returning initializedValidatorinstances. This is the Hibernate Validator default implementation of theValidatorFactoryinterface.- Author:
- Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI, Chris Beckey <cbeckey@paypal.com>, Guillaume Smet, Marko Bekhta
-
-
Constructor Summary
Constructors Constructor Description ValidatorFactoryImpl(ConfigurationState configurationState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes theValidatorFactoryinstance.ClockProvidergetClockProvider()Returns theClockProviderinstance configured at initialization time for theValidatorFactory.ConstraintValidatorFactorygetConstraintValidatorFactory()Returns theConstraintValidatorFactoryinstance configured at initialization time for theValidatorFactory.ExecutableParameterNameProvidergetExecutableParameterNameProvider()GetterPropertySelectionStrategygetGetterPropertySelectionStrategy()Returns the getter property selection strategy defining the rules determining if a method is a getter or not.MessageInterpolatorgetMessageInterpolator()Returns theMessageInterpolatorinstance configured at initialization time for theValidatorFactory.ParameterNameProvidergetParameterNameProvider()Returns theParameterNameProviderinstance configured at initialization time for theValidatorFactory.PropertyNodeNameProvidergetPropertyNodeNameProvider()Returns the property node name provider used to resolve the name of a property node when creating the property path.ScriptEvaluatorFactorygetScriptEvaluatorFactory()Returns the factory responsible for creatingScriptEvaluators used to evaluate script expressions ofScriptAssertandParameterScriptAssertconstraints.DurationgetTemporalValidationTolerance()Returns the temporal validation tolerance i.e.TraversableResolvergetTraversableResolver()Returns theTraversableResolverinstance configured at initialization time for theValidatorFactory.ValidatorgetValidator()Returns an initializedValidatorinstance using the factory defaults for message interpolator, traversable resolver and constraint validator factory.ValidatorFactoryScopedContextgetValidatorFactoryScopedContext()booleanisFailFast()booleanisTraversableResolverResultCacheEnabled()<T> Tunwrap(Class<T> type)Returns an instance of the specified type allowing access to provider-specific APIs.HibernateValidatorContextusingContext()Returns a context for validator configuration via options from the Bean Validation API as well as specific ones from Hibernate Validator.
-
-
-
Constructor Detail
-
ValidatorFactoryImpl
public ValidatorFactoryImpl(ConfigurationState configurationState)
-
-
Method Detail
-
getValidator
public Validator getValidator()
Description copied from interface:ValidatorFactoryReturns an initializedValidatorinstance using the factory defaults for message interpolator, traversable resolver and constraint validator factory.Validator instances can be pooled and shared by the implementation.
- Specified by:
getValidatorin interfaceValidatorFactory- Returns:
- an initialized
Validatorinstance
-
getMessageInterpolator
public MessageInterpolator getMessageInterpolator()
Description copied from interface:ValidatorFactoryReturns theMessageInterpolatorinstance configured at initialization time for theValidatorFactory. This is the instance used byValidatorFactory.getValidator().- Specified by:
getMessageInterpolatorin interfaceValidatorFactory- Returns:
MessageInterpolatorinstance
-
getTraversableResolver
public TraversableResolver getTraversableResolver()
Description copied from interface:ValidatorFactoryReturns theTraversableResolverinstance configured at initialization time for theValidatorFactory. This is the instance used byValidatorFactory.getValidator().- Specified by:
getTraversableResolverin interfaceValidatorFactory- Returns:
TraversableResolverinstance
-
getConstraintValidatorFactory
public ConstraintValidatorFactory getConstraintValidatorFactory()
Description copied from interface:ValidatorFactoryReturns theConstraintValidatorFactoryinstance configured at initialization time for theValidatorFactory. This is the instance used byValidatorFactory.getValidator().- Specified by:
getConstraintValidatorFactoryin interfaceValidatorFactory- Returns:
ConstraintValidatorFactoryinstance
-
getParameterNameProvider
public ParameterNameProvider getParameterNameProvider()
Description copied from interface:ValidatorFactoryReturns theParameterNameProviderinstance configured at initialization time for theValidatorFactory. This is the instance used by #getValidator().- Specified by:
getParameterNameProviderin interfaceValidatorFactory- Returns:
ParameterNameProviderinstance
-
getExecutableParameterNameProvider
public ExecutableParameterNameProvider getExecutableParameterNameProvider()
-
getClockProvider
public ClockProvider getClockProvider()
Description copied from interface:ValidatorFactoryReturns theClockProviderinstance configured at initialization time for theValidatorFactory. This is the instance used by #getValidator().- Specified by:
getClockProviderin interfaceValidatorFactory- Returns:
ClockProviderinstance
-
getScriptEvaluatorFactory
public ScriptEvaluatorFactory getScriptEvaluatorFactory()
Description copied from interface:HibernateValidatorFactoryReturns the factory responsible for creatingScriptEvaluators used to evaluate script expressions ofScriptAssertandParameterScriptAssertconstraints.- Specified by:
getScriptEvaluatorFactoryin interfaceHibernateValidatorFactory- Returns:
- a
ScriptEvaluatorFactoryinstance
-
getTemporalValidationTolerance
public Duration getTemporalValidationTolerance()
Description copied from interface:HibernateValidatorFactoryReturns the temporal validation tolerance i.e. the acceptable margin of error when comparing date/time in temporal constraints.- Specified by:
getTemporalValidationTolerancein interfaceHibernateValidatorFactory- Returns:
- the tolerance
-
getGetterPropertySelectionStrategy
public GetterPropertySelectionStrategy getGetterPropertySelectionStrategy()
Description copied from interface:HibernateValidatorFactoryReturns the getter property selection strategy defining the rules determining if a method is a getter or not.- Specified by:
getGetterPropertySelectionStrategyin interfaceHibernateValidatorFactory- Returns:
- the getter property selection strategy of the current
ValidatorFactory
-
getPropertyNodeNameProvider
public PropertyNodeNameProvider getPropertyNodeNameProvider()
Description copied from interface:HibernateValidatorFactoryReturns the property node name provider used to resolve the name of a property node when creating the property path.- Specified by:
getPropertyNodeNameProviderin interfaceHibernateValidatorFactory- Returns:
- the property node name provider of the current
ValidatorFactory
-
isFailFast
public boolean isFailFast()
-
isTraversableResolverResultCacheEnabled
public boolean isTraversableResolverResultCacheEnabled()
-
unwrap
public <T> T unwrap(Class<T> type)
Description copied from interface:ValidatorFactoryReturns 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, aValidationExceptionis thrown.- Specified by:
unwrapin interfaceValidatorFactory- Type Parameters:
T- the type of the object to be returned- Parameters:
type- the class of the object to be returned- Returns:
- an instance of the specified class
-
usingContext
public HibernateValidatorContext usingContext()
Description copied from interface:HibernateValidatorFactoryReturns a context for validator configuration via options from the Bean Validation API as well as specific ones from Hibernate Validator.- Specified by:
usingContextin interfaceHibernateValidatorFactory- Specified by:
usingContextin interfaceValidatorFactory- Returns:
- A context for validator configuration.
-
close
public void close()
Description copied from interface:ValidatorFactoryCloses theValidatorFactoryinstance. After theValidatorFactoryinstance is closed, calling the following methods is not allowed:- methods of this
ValidatorFactoryinstance - methods of
Validatorinstances created by thisValidatorFactory
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceValidatorFactory
- methods of this
-
getValidatorFactoryScopedContext
public ValidatorFactoryScopedContext getValidatorFactoryScopedContext()
-
-