org.springmodules.validation.bean.conf.loader
Class SimpleBeanValidationConfigurationLoader

java.lang.Object
  extended by org.springmodules.validation.bean.conf.loader.SimpleBeanValidationConfigurationLoader
All Implemented Interfaces:
BeanValidationConfigurationLoader

public class SimpleBeanValidationConfigurationLoader
extends Object
implements BeanValidationConfigurationLoader

A simple implementation of BeanValidationConfigurationLoader that enables registration of bean validation configuration with classes.

This class can be used on its own or can be extended and used as configuration cache.

Author:
Uri Boness

Constructor Summary
SimpleBeanValidationConfigurationLoader()
          Constructs a new SimpleBeanValidationConfigurationLoader.
 
Method Summary
 BeanValidationConfiguration loadConfiguration(Class clazz)
          Returns the bean validation configuration that is associated with the given class, or one of its super classes.
 void setClassValidation(Class clazz, BeanValidationConfiguration configuration)
          Registeres the given bean validation configuration with a given class.
 boolean supports(Class clazz)
          Indicates whether the given class is supported by this loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBeanValidationConfigurationLoader

public SimpleBeanValidationConfigurationLoader()
Constructs a new SimpleBeanValidationConfigurationLoader.

Method Detail

supports

public boolean supports(Class clazz)
Description copied from interface: BeanValidationConfigurationLoader
Indicates whether the given class is supported by this loader. The BeanValidationConfigurationLoader.loadConfiguration(Class) will return a validation configuration only for the supported classes. This method should typically be called to determine whether the BeanValidationConfigurationLoader.loadConfiguration(Class) should be called.

Specified by:
supports in interface BeanValidationConfigurationLoader
Parameters:
clazz - The class to be checked.
Returns:
true if this loader can load a valication configuration for the given class, false otherwise.
See Also:
BeanValidationConfigurationLoader.supports(Class)

loadConfiguration

public BeanValidationConfiguration loadConfiguration(Class clazz)
Returns the bean validation configuration that is associated with the given class, or one of its super classes. Returns null if no such association was found.

Specified by:
loadConfiguration in interface BeanValidationConfigurationLoader
Parameters:
clazz - The class of which the validation configuration is requested.
Returns:
The validation configuration that is associated with the given class.

setClassValidation

public void setClassValidation(Class clazz,
                               BeanValidationConfiguration configuration)
Registeres the given bean validation configuration with a given class.

Parameters:
clazz - The class to which the given validation configuration will be associated.
configuration - The bean validation configuration to associate with the given class.


Copyright © 2009. All Rights Reserved.