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 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(Class<?> clazz) |
void |
validate(Object target,
org.springframework.validation.Errors errors) |
void |
validate(Object target,
org.springframework.validation.Errors errors,
Object... validationHints) |
public final org.springframework.validation.Validator getTarget()
public boolean supports(Class<?> clazz)
supports
in interface org.springframework.validation.Validator
public void validate(Object target, org.springframework.validation.Errors errors)
validate
in interface org.springframework.validation.Validator
public void validate(Object target, org.springframework.validation.Errors errors, Object... validationHints)
validate
in interface org.springframework.validation.SmartValidator
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public 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
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.