Class DefaultValidatorConfiguration
java.lang.Object
io.micronaut.validation.validator.DefaultValidatorConfiguration
- All Implemented Interfaces:
io.micronaut.core.convert.ConversionServiceAware
,io.micronaut.core.convert.ConversionServiceProvider
,io.micronaut.core.util.Toggleable
,ValidatorConfiguration
,jakarta.validation.ValidatorContext
@ConfigurationProperties("micronaut.validator")
public class DefaultValidatorConfiguration
extends Object
implements ValidatorConfiguration, io.micronaut.core.util.Toggleable, jakarta.validation.ValidatorContext, io.micronaut.core.convert.ConversionServiceAware
The default configuration for the validator.
- Since:
- 1.2
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.validation.validator.ValidatorConfiguration
ENABLED, PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionjakarta.validation.ValidatorContext
addValueExtractor
(jakarta.validation.valueextraction.ValueExtractor<?> extractor) jakarta.validation.ValidatorContext
clockProvider
(jakarta.validation.ClockProvider clockProvider) jakarta.validation.ValidatorContext
constraintValidatorFactory
(jakarta.validation.ConstraintValidatorFactory factory) io.micronaut.core.beans.BeanIntrospector
The bean introspector.static Class<?>
getClassFromType
(Type type) @NonNull jakarta.validation.ClockProvider
jakarta.validation.ConstraintValidatorFactory
@NonNull ConstraintValidatorRegistry
io.micronaut.core.convert.ConversionService
jakarta.validation.ClockProvider
@NonNull jakarta.validation.MessageInterpolator
@NonNull jakarta.validation.TraversableResolver
@NonNull io.micronaut.context.ExecutionHandleLocator
The execution handler locator to use.@NonNull jakarta.validation.MessageInterpolator
@NonNull jakarta.validation.TraversableResolver
jakarta.validation.Validator
@NonNull ValueExtractorRegistry
boolean
jakarta.validation.ValidatorContext
messageInterpolator
(jakarta.validation.MessageInterpolator messageInterpolator) jakarta.validation.ValidatorContext
parameterNameProvider
(jakarta.validation.ParameterNameProvider parameterNameProvider) final void
setBeanIntrospector
(io.micronaut.core.beans.BeanIntrospector beanIntrospector) setClockProvider
(@Nullable jakarta.validation.ClockProvider clockProvider) Sets the clock provider to use.setConstraintValidatorRegistry
(@Nullable ConstraintValidatorRegistry constraintValidatorRegistry) Sets the constraint validator registry to use.void
setConversionService
(io.micronaut.core.convert.ConversionService conversionService) Sets the conversion service.setEnabled
(boolean enabled) Sets whether Micronaut's validator is enabled.setExecutionHandleLocator
(@Nullable io.micronaut.context.BeanContext beanContext) Sets the execution handler locator to use.void
setInternalConstraintValidatorFactory
(InternalConstraintValidatorFactory constraintValidatorFactory) Inject internalInternalConstraintValidatorFactory
.setMessageInterpolator
(@Nullable jakarta.validation.MessageInterpolator messageInterpolator) Sets the message interpolator to use.setTraversableResolver
(@Nullable jakarta.validation.TraversableResolver traversableResolver) Sets the traversable resolver to use.setValueExtractorRegistry
(@Nullable ValueExtractorRegistry valueExtractorRegistry) Sets the value extractor registry use.jakarta.validation.ValidatorContext
traversableResolver
(jakarta.validation.TraversableResolver traversableResolver)
-
Constructor Details
-
DefaultValidatorConfiguration
public DefaultValidatorConfiguration()
-
-
Method Details
-
setConversionService
@Inject public void setConversionService(io.micronaut.core.convert.ConversionService conversionService) Sets the conversion service.- Specified by:
setConversionService
in interfaceio.micronaut.core.convert.ConversionServiceAware
- Parameters:
conversionService
- The conversion service
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()- Specified by:
getConversionService
in interfaceio.micronaut.core.convert.ConversionServiceProvider
-
getConstraintValidatorRegistry
- Specified by:
getConstraintValidatorRegistry
in interfaceValidatorConfiguration
- Returns:
- The constraint registry to use.
-
getConstraintValidatorFactory
public jakarta.validation.ConstraintValidatorFactory getConstraintValidatorFactory()- Specified by:
getConstraintValidatorFactory
in interfaceValidatorConfiguration
- Returns:
- The constraint factory to use.
-
setInternalConstraintValidatorFactory
@Internal @Inject public void setInternalConstraintValidatorFactory(InternalConstraintValidatorFactory constraintValidatorFactory) Inject internalInternalConstraintValidatorFactory
.- Parameters:
constraintValidatorFactory
- the factory
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
-
setEnabled
Sets whether Micronaut's validator is enabled.- Parameters:
enabled
- True if it is- Returns:
- this configuration
-
setConstraintValidatorRegistry
@Inject public DefaultValidatorConfiguration setConstraintValidatorRegistry(@Nullable @Nullable ConstraintValidatorRegistry constraintValidatorRegistry) Sets the constraint validator registry to use.- Parameters:
constraintValidatorRegistry
- The registry to use- Returns:
- this configuration
-
getValueExtractorRegistry
- Specified by:
getValueExtractorRegistry
in interfaceValidatorConfiguration
- Returns:
- The value extractor registry
-
setValueExtractorRegistry
@Inject public DefaultValidatorConfiguration setValueExtractorRegistry(@Nullable @Nullable ValueExtractorRegistry valueExtractorRegistry) Sets the value extractor registry use.- Parameters:
valueExtractorRegistry
- The registry- Returns:
- this configuration
-
getClockProvider
@NonNull public @NonNull jakarta.validation.ClockProvider getClockProvider()- Specified by:
getClockProvider
in interfaceValidatorConfiguration
- Returns:
- The clock provider
-
getDefaultClockProvider
public jakarta.validation.ClockProvider getDefaultClockProvider()- Specified by:
getDefaultClockProvider
in interfaceValidatorConfiguration
- Returns:
- The default clock provider
-
setClockProvider
@Inject public DefaultValidatorConfiguration setClockProvider(@Nullable @Nullable jakarta.validation.ClockProvider clockProvider) Sets the clock provider to use.- Parameters:
clockProvider
- The clock provider- Returns:
- this configuration
-
getDefaultTraversableResolver
@NonNull public @NonNull jakarta.validation.TraversableResolver getDefaultTraversableResolver()- Specified by:
getDefaultTraversableResolver
in interfaceValidatorConfiguration
- Returns:
- The default traversable resolver to use
-
getTraversableResolver
@NonNull public @NonNull jakarta.validation.TraversableResolver getTraversableResolver()- Specified by:
getTraversableResolver
in interfaceValidatorConfiguration
- Returns:
- The traversable resolver to use
-
setTraversableResolver
@Inject public DefaultValidatorConfiguration setTraversableResolver(@Nullable @Nullable jakarta.validation.TraversableResolver traversableResolver) Sets the traversable resolver to use.- Parameters:
traversableResolver
- The resolver- Returns:
- This configuration
-
getMessageInterpolator
@NonNull public @NonNull jakarta.validation.MessageInterpolator getMessageInterpolator()- Specified by:
getMessageInterpolator
in interfaceValidatorConfiguration
- Returns:
- The message interpolator
-
getDefaultMessageInterpolator
@NonNull public @NonNull jakarta.validation.MessageInterpolator getDefaultMessageInterpolator()- Specified by:
getDefaultMessageInterpolator
in interfaceValidatorConfiguration
- Returns:
- The default message interpolator
-
setMessageInterpolator
@Inject public DefaultValidatorConfiguration setMessageInterpolator(@Nullable @Nullable jakarta.validation.MessageInterpolator messageInterpolator) Sets the message interpolator to use.- Parameters:
messageInterpolator
- The message interpolator- Returns:
- this configuration
-
getExecutionHandleLocator
@NonNull public @NonNull io.micronaut.context.ExecutionHandleLocator getExecutionHandleLocator()Description copied from interface:ValidatorConfiguration
The execution handler locator to use.- Specified by:
getExecutionHandleLocator
in interfaceValidatorConfiguration
- Returns:
- The locator
-
setExecutionHandleLocator
@Inject public DefaultValidatorConfiguration setExecutionHandleLocator(@Nullable @Nullable io.micronaut.context.BeanContext beanContext) Sets the execution handler locator to use.- Parameters:
beanContext
- The beanContext- Returns:
- this configuration
-
messageInterpolator
public jakarta.validation.ValidatorContext messageInterpolator(jakarta.validation.MessageInterpolator messageInterpolator) - Specified by:
messageInterpolator
in interfacejakarta.validation.ValidatorContext
-
traversableResolver
public jakarta.validation.ValidatorContext traversableResolver(jakarta.validation.TraversableResolver traversableResolver) - Specified by:
traversableResolver
in interfacejakarta.validation.ValidatorContext
-
constraintValidatorFactory
public jakarta.validation.ValidatorContext constraintValidatorFactory(jakarta.validation.ConstraintValidatorFactory factory) - Specified by:
constraintValidatorFactory
in interfacejakarta.validation.ValidatorContext
-
parameterNameProvider
public jakarta.validation.ValidatorContext parameterNameProvider(jakarta.validation.ParameterNameProvider parameterNameProvider) - Specified by:
parameterNameProvider
in interfacejakarta.validation.ValidatorContext
-
clockProvider
public jakarta.validation.ValidatorContext clockProvider(jakarta.validation.ClockProvider clockProvider) - Specified by:
clockProvider
in interfacejakarta.validation.ValidatorContext
-
addValueExtractor
public jakarta.validation.ValidatorContext addValueExtractor(jakarta.validation.valueextraction.ValueExtractor<?> extractor) - Specified by:
addValueExtractor
in interfacejakarta.validation.ValidatorContext
-
getValidator
public jakarta.validation.Validator getValidator()- Specified by:
getValidator
in interfacejakarta.validation.ValidatorContext
-
getBeanIntrospector
public io.micronaut.core.beans.BeanIntrospector getBeanIntrospector()Description copied from interface:ValidatorConfiguration
The bean introspector.- Specified by:
getBeanIntrospector
in interfaceValidatorConfiguration
- Returns:
- The introspector
-
setBeanIntrospector
public final void setBeanIntrospector(io.micronaut.core.beans.BeanIntrospector beanIntrospector) -
getClassFromType
-