org.springmodules.validation.bean.conf.loader.xml
Class SimpleValidationRuleElementHandlerRegistry

java.lang.Object
  extended by org.springmodules.validation.util.context.BasicContextAware
      extended by org.springmodules.validation.bean.conf.loader.xml.SimpleValidationRuleElementHandlerRegistry
All Implemented Interfaces:
ValidationRuleElementHandlerRegistry, ConditionExpressionBased, ContextAware, FunctionExpressionBased
Direct Known Subclasses:
DefaultValidationRuleElementHandlerRegistry

public class SimpleValidationRuleElementHandlerRegistry
extends BasicContextAware
implements ValidationRuleElementHandlerRegistry, ConditionExpressionBased, FunctionExpressionBased

A simple implementation of ValidationRuleElementHandlerRegistry that enableds registration of element handlers.

Author:
Uri Boness

Field Summary
 
Fields inherited from class org.springmodules.validation.util.context.BasicContextAware
applicationContext, applicationEventPublisher, beanFactory, messageSource, resourceLoader, servletContext
 
Constructor Summary
SimpleValidationRuleElementHandlerRegistry()
          Constructs a new DefaultValidationRuleElementHandlerRegistry with the default handlers.
 
Method Summary
 void afterPropertiesSet()
           
 ClassValidationElementHandler findClassHandler(org.w3c.dom.Element element, java.lang.Class clazz)
          Returns the class validation element handler that can handle the given element.
protected  void findConditionExpressionParserInApplicationContext()
           
protected  void findFunctionExpressionParserInApplicationContext()
           
protected  java.lang.Object findObjectInApplicationContext(java.lang.Class clazz)
           
 PropertyValidationElementHandler findPropertyHandler(org.w3c.dom.Element element, java.lang.Class clazz, java.beans.PropertyDescriptor descriptor)
          Returns the property validation element handler that can handle the given element.
 ClassValidationElementHandler[] getClassHandlers()
          Return all class handlers that are registered with this registry.
 PropertyValidationElementHandler[] getPropertyHandlers()
          Return all property handlers that are registered with this registry.
 void registerClassHandler(ClassValidationElementHandler handler)
          Registers the given class handler with this registry.
 void registerPropertyHandler(PropertyValidationElementHandler handler)
          Registers the given property handler with this registry.
 void setClassHandlers(ClassValidationElementHandler[] handlers)
          Resets the class handlers in this registry with the given ones.
 void setConditionExpressionParser(ConditionExpressionParser conditionExpressionParser)
          Sets the condition expression parser to be used when parsing the condition expression.
protected  void setExpressionParsers(java.lang.Object object)
           
 void setExtraClassHandlers(ClassValidationElementHandler[] handlers)
          Registeres the given class handlers with this registry.
 void setExtraPropertyHandlers(PropertyValidationElementHandler[] handlers)
          Registeres the given property handlers with this registry.
 void setFunctionExpressionParser(FunctionExpressionParser functionExpressionParser)
          Sets the function expression parser to be used when parsing the function expressions.
 void setPropertyHandlers(PropertyValidationElementHandler[] handlers)
          Resets the property handlers in this registry to the given ones (overriding the existing ones).
 
Methods inherited from class org.springmodules.validation.util.context.BasicContextAware
initLifecycle, initLifecycle, setApplicationContext, setApplicationEventPublisher, setBeanFactory, setMessageSource, setResourceLoader, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleValidationRuleElementHandlerRegistry

public SimpleValidationRuleElementHandlerRegistry()
Constructs a new DefaultValidationRuleElementHandlerRegistry with the default handlers.

Method Detail

registerClassHandler

public void registerClassHandler(ClassValidationElementHandler handler)
Registers the given class handler with this registry. The registered handler is registered in such a way that it will be checked first for support (LIFC - Last In First Checked).


findClassHandler

public ClassValidationElementHandler findClassHandler(org.w3c.dom.Element element,
                                                      java.lang.Class clazz)
Description copied from interface: ValidationRuleElementHandlerRegistry
Returns the class validation element handler that can handle the given element.

Specified by:
findClassHandler in interface ValidationRuleElementHandlerRegistry
Parameters:
element - The element to be handled.
clazz - The validated class.
Returns:
The class validation element handler that can handle the given element.
See Also:
ValidationRuleElementHandlerRegistry.findClassHandler(org.w3c.dom.Element, Class)

registerPropertyHandler

public void registerPropertyHandler(PropertyValidationElementHandler handler)
Registers the given property handler with this registry. The registered handler is registered in such a way that it will be checked first for support. (LIFC - Last In First Checked).


findPropertyHandler

public PropertyValidationElementHandler findPropertyHandler(org.w3c.dom.Element element,
                                                            java.lang.Class clazz,
                                                            java.beans.PropertyDescriptor descriptor)
Description copied from interface: ValidationRuleElementHandlerRegistry
Returns the property validation element handler that can handle the given element.

Specified by:
findPropertyHandler in interface ValidationRuleElementHandlerRegistry
Parameters:
element - The element be handled.
clazz - The validated class.
descriptor - The property descriptor of the validated property.
Returns:
The property validation element handler that can handle the given element.
See Also:
ValidationRuleElementHandlerRegistry.findPropertyHandler(org.w3c.dom.Element, Class, java.beans.PropertyDescriptor)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Throws:
java.lang.Exception

setExtraClassHandlers

public void setExtraClassHandlers(ClassValidationElementHandler[] handlers)
Registeres the given class handlers with this registry.

Parameters:
handlers - The handlers to register with this registry.

setClassHandlers

public void setClassHandlers(ClassValidationElementHandler[] handlers)
Resets the class handlers in this registry with the given ones.

Parameters:
handlers - The class handlers to be registered with this registry.

setExtraPropertyHandlers

public void setExtraPropertyHandlers(PropertyValidationElementHandler[] handlers)
Registeres the given property handlers with this registry.

Parameters:
handlers - The handlers to register with this registry.

setPropertyHandlers

public void setPropertyHandlers(PropertyValidationElementHandler[] handlers)
Resets the property handlers in this registry to the given ones (overriding the existing ones).

Parameters:
handlers - The property handlers to register with this registry.

getClassHandlers

public ClassValidationElementHandler[] getClassHandlers()
Return all class handlers that are registered with this registry.

Returns:
All class handlers that are registered with this registry.

getPropertyHandlers

public PropertyValidationElementHandler[] getPropertyHandlers()
Return all property handlers that are registered with this registry.

Returns:
All property handlers that are registered with this registry.

setFunctionExpressionParser

public void setFunctionExpressionParser(FunctionExpressionParser functionExpressionParser)
Description copied from interface: FunctionExpressionBased
Sets the function expression parser to be used when parsing the function expressions.

Specified by:
setFunctionExpressionParser in interface FunctionExpressionBased
Parameters:
functionExpressionParser - The function expression parser to be used.
See Also:
FunctionExpressionBased.setFunctionExpressionParser(org.springmodules.validation.util.fel.FunctionExpressionParser)

setConditionExpressionParser

public void setConditionExpressionParser(ConditionExpressionParser conditionExpressionParser)
Description copied from interface: ConditionExpressionBased
Sets the condition expression parser to be used when parsing the condition expression.

Specified by:
setConditionExpressionParser in interface ConditionExpressionBased
Parameters:
conditionExpressionParser - The condition expression parser to be used.
See Also:
ConditionExpressionBased.setConditionExpressionParser(org.springmodules.validation.util.cel.ConditionExpressionParser)

setExpressionParsers

protected void setExpressionParsers(java.lang.Object object)

findConditionExpressionParserInApplicationContext

protected void findConditionExpressionParserInApplicationContext()

findFunctionExpressionParserInApplicationContext

protected void findFunctionExpressionParserInApplicationContext()

findObjectInApplicationContext

protected java.lang.Object findObjectInApplicationContext(java.lang.Class clazz)


Copyright © 2005. All Rights Reserved.