Class ValidatorAdapter
java.lang.Object
org.springframework.boot.autoconfigure.validation.ValidatorAdapter
- All Implemented Interfaces:
Aware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,SmartValidator
,Validator
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.- Since:
- 2.0.0
- Author:
- Stephane Nicoll, Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
destroy()
static Validator
get
(ApplicationContext applicationContext, Validator validator) final Validator
void
setApplicationContext
(ApplicationContext applicationContext) boolean
void
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.validation.SmartValidator
validateValue
-
Method Details
-
getTarget
-
supports
-
validate
-
validate
- Specified by:
validate
in interfaceSmartValidator
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-
destroy
- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
-
get
Return aValidator
that only implements theValidator
interface, wrapping it if necessary.If the specified
Validator
is notnull
, it is wrapped. If not, aValidator
is 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
-