Class ValidatorAdapter
java.lang.Object
org.springframework.boot.validation.autoconfigure.ValidatorAdapter
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.validation.SmartValidator, org.springframework.validation.Validator
public class ValidatorAdapter
extends Object
implements org.springframework.validation.SmartValidator, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Validator implementation that delegates calls to another Validator.
This Validator implements Spring's SmartValidator interface but does
not implement the JSR-303 jakarta.validator.Validator interface.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()static org.springframework.validation.Validatorget(org.springframework.context.ApplicationContext applicationContext, @Nullable org.springframework.validation.Validator validator) Return aValidatorthat only implements theValidatorinterface, wrapping it if necessary.final org.springframework.validation.ValidatorvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) boolean<T> @Nullable TvoidvoidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.validation.SmartValidator
validateValueMethods inherited from interface org.springframework.validation.Validator
validateObject
-
Method Details
-
getTarget
public final org.springframework.validation.Validator getTarget() -
supports
- Specified by:
supportsin interfaceorg.springframework.validation.Validator
-
validate
- Specified by:
validatein interfaceorg.springframework.validation.Validator
-
validate
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
-
destroy
-
get
public static org.springframework.validation.Validator get(org.springframework.context.ApplicationContext applicationContext, @Nullable org.springframework.validation.Validator validator) Return aValidatorthat only implements theValidatorinterface, wrapping it if necessary.If the specified
Validatoris notnull, it is wrapped. If not, aValidatoris retrieved from the context and wrapped. Otherwise, a new default validator is created.- Parameters:
applicationContext- the application contextvalidator- an existing validator to use ornull- Returns:
- the validator to use
-
unwrap
- Specified by:
unwrapin interfaceorg.springframework.validation.SmartValidator
-