org.springmodules.validation.bean.rule.resolver
Class ValangErrorArgumentsResolver

java.lang.Object
  extended by org.springmodules.validation.bean.rule.resolver.ValangErrorArgumentsResolver
All Implemented Interfaces:
ErrorArgumentsResolver

public class ValangErrorArgumentsResolver
extends Object
implements ErrorArgumentsResolver

Resolves error arguments based on valang expressions.

Author:
Uri Boness

Constructor Summary
ValangErrorArgumentsResolver()
          Creates a new ValangErrorArgumentsResolver with no argument expressions, that is, there will be no arguments.
ValangErrorArgumentsResolver(String[] expressions)
          Creates a new ValangErrorArgumentsResolver with the given argument expressions.
ValangErrorArgumentsResolver(String[] expressions, Map functionsByName)
          Creates a new ValangErrorArgumentsResolver with given argument expressions and custom functions that will be used by the valang parser.
 
Method Summary
protected  Function parseFunction(String expression, Map functionsByName)
          Parses a valang Function from the given argument expression and custom functions.
 Object[] resolveArguments(Object obj)
          Returns the error arguments that are resolved by the configured valang expressions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValangErrorArgumentsResolver

public ValangErrorArgumentsResolver()
Creates a new ValangErrorArgumentsResolver with no argument expressions, that is, there will be no arguments.


ValangErrorArgumentsResolver

public ValangErrorArgumentsResolver(String[] expressions)
Creates a new ValangErrorArgumentsResolver with the given argument expressions. This constructor uses the default {@link ValangParser).

Parameters:
expressions - The argument valang expressions.

ValangErrorArgumentsResolver

public ValangErrorArgumentsResolver(String[] expressions,
                                    Map functionsByName)
Creates a new ValangErrorArgumentsResolver with given argument expressions and custom functions that will be used by the valang parser.

Parameters:
expressions - The arguments valang expressions.
functionsByName - A map of custom valang functiosns where the key is the function name and the value is the name of the function class.
Method Detail

resolveArguments

public Object[] resolveArguments(Object obj)
Returns the error arguments that are resolved by the configured valang expressions.

Specified by:
resolveArguments in interface ErrorArgumentsResolver
Parameters:
obj - The validated object.
Returns:
The validation error arguments.
See Also:
ErrorArgumentsResolver.resolveArguments(Object)

parseFunction

protected Function parseFunction(String expression,
                                 Map functionsByName)
Parses a valang Function from the given argument expression and custom functions.

Parameters:
expression - The given argument expression.
functionsByName - The custom valang functions.
Returns:
The parsed function.


Copyright © 2009. All Rights Reserved.