public class ValidatorAdapter
extends java.lang.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 javax.validator.Validator interface.| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
static org.springframework.validation.Validator |
get(org.springframework.context.ApplicationContext applicationContext,
org.springframework.validation.Validator validator)
Return a
Validator that only implements the Validator interface,
wrapping it if necessary. |
org.springframework.validation.Validator |
getTarget() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
boolean |
supports(java.lang.Class<?> clazz) |
void |
validate(java.lang.Object target,
org.springframework.validation.Errors errors) |
void |
validate(java.lang.Object target,
org.springframework.validation.Errors errors,
java.lang.Object... validationHints) |
public final org.springframework.validation.Validator getTarget()
public boolean supports(java.lang.Class<?> clazz)
supports in interface org.springframework.validation.Validatorpublic void validate(java.lang.Object target,
org.springframework.validation.Errors errors)
validate in interface org.springframework.validation.Validatorpublic void validate(java.lang.Object target,
org.springframework.validation.Errors errors,
java.lang.Object... validationHints)
validate in interface org.springframework.validation.SmartValidatorpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exceptionpublic static org.springframework.validation.Validator get(org.springframework.context.ApplicationContext applicationContext,
org.springframework.validation.Validator validator)
Validator that only implements the Validator interface,
wrapping it if necessary.
If the specified Validator is not null, it is wrapped. If not, a
Validator is retrieved from the context and wrapped.
Otherwise, a new default validator is created.
applicationContext - the application contextvalidator - an existing validator to use or null