类 ValidatorAdapter
- java.lang.Object
- org.springframework.boot.autoconfigure.validation.ValidatorAdapter
- 所有已实现的接口:
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
Validatorimplementation that delegates calls to anotherValidator. ThisValidatorimplements Spring'sSmartValidatorinterface but does not implement the JSR-303javax.validator.Validatorinterface.- 从以下版本开始:
- 2.0.0
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()voiddestroy()static org.springframework.validation.Validatorget(org.springframework.context.ApplicationContext applicationContext, org.springframework.validation.Validator validator)Return aValidatorthat only implements theValidatorinterface, wrapping it if necessary.org.springframework.validation.ValidatorgetTarget()voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)booleansupports(Class<?> clazz)voidvalidate(Object target, org.springframework.validation.Errors errors)voidvalidate(Object target, org.springframework.validation.Errors errors, Object... validationHints)
方法详细资料
getTarget
public final org.springframework.validation.Validator getTarget()
supports
public boolean supports(Class<?> clazz)
- 指定者:
supports在接口中org.springframework.validation.Validator
validate
public void validate(Object target, org.springframework.validation.Errors errors)
- 指定者:
validate在接口中org.springframework.validation.Validator
validate
public void validate(Object target, org.springframework.validation.Errors errors, Object... validationHints)
- 指定者:
validate在接口中org.springframework.validation.SmartValidator
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- 指定者:
setApplicationContext在接口中org.springframework.context.ApplicationContextAware- 抛出:
org.springframework.beans.BeansException
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- 指定者:
afterPropertiesSet在接口中org.springframework.beans.factory.InitializingBean- 抛出:
Exception
destroy
public void destroy() throws Exception
- 指定者:
destroy在接口中org.springframework.beans.factory.DisposableBean- 抛出:
Exception
get
public static org.springframework.validation.Validator get(org.springframework.context.ApplicationContext applicationContext, 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.- 参数:
applicationContext- the application contextvalidator- an existing validator to use ornull- 返回:
- the validator to use