org.springframework.validation.beanvalidation
Class CustomValidatorBean

java.lang.Object
  extended by org.springframework.validation.beanvalidation.SpringValidatorAdapter
      extended by org.springframework.validation.beanvalidation.CustomValidatorBean
All Implemented Interfaces:
InitializingBean, Validator

public class CustomValidatorBean
extends SpringValidatorAdapter
implements InitializingBean

Configurable bean class that exposes a specific JSR-303 Validator through its original interface as well as through the Spring Validator interface.

Since:
3.0
Author:
Juergen Hoeller

Field Summary
private  MessageInterpolator messageInterpolator
           
private  TraversableResolver traversableResolver
           
private  ValidatorFactory validatorFactory
           
 
Constructor Summary
CustomValidatorBean()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 void setMessageInterpolator(MessageInterpolator messageInterpolator)
          Specify a custom MessageInterpolator to use for this Validator.
 void setTraversableResolver(TraversableResolver traversableResolver)
          Specify a custom TraversableResolver to use for this Validator.
 void setValidatorFactory(ValidatorFactory validatorFactory)
          Set the ValidatorFactory to obtain the target Validator from.
 
Methods inherited from class org.springframework.validation.beanvalidation.SpringValidatorAdapter
getArgumentsForConstraint, getConstraintsForClass, setTargetValidator, supports, unwrap, validate, validate, validateProperty, validateValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validatorFactory

private ValidatorFactory validatorFactory

messageInterpolator

private MessageInterpolator messageInterpolator

traversableResolver

private TraversableResolver traversableResolver
Constructor Detail

CustomValidatorBean

public CustomValidatorBean()
Method Detail

setValidatorFactory

public void setValidatorFactory(ValidatorFactory validatorFactory)
Set the ValidatorFactory to obtain the target Validator from.

Default is javax.validation.Validation#buildDefaultValidatorFactory().


setMessageInterpolator

public void setMessageInterpolator(MessageInterpolator messageInterpolator)
Specify a custom MessageInterpolator to use for this Validator.


setTraversableResolver

public void setTraversableResolver(TraversableResolver traversableResolver)
Specify a custom TraversableResolver to use for this Validator.


afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean