public class ValidatorAdapter extends Object implements SmartValidator, ApplicationContextAware, InitializingBean, 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 Validator |
get(ApplicationContext applicationContext,
Validator validator)
|
Validator |
getTarget() |
void |
setApplicationContext(ApplicationContext applicationContext) |
boolean |
supports(Class<?> clazz) |
void |
validate(Object target,
Errors errors) |
void |
validate(Object target,
Errors errors,
Object... validationHints) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validateValue
public final Validator getTarget()
public void validate(Object target, Errors errors, Object... validationHints)
validate
in interface SmartValidator
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public static Validator get(ApplicationContext applicationContext, 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.