org.springmodules.validation.valang.parser
Class SimpleValangBased
java.lang.Object
org.springmodules.validation.util.context.BasicContextAware
org.springmodules.validation.valang.parser.SimpleValangBased
- All Implemented Interfaces:
- BeanFactoryAware, ApplicationContextAware, ApplicationEventPublisherAware, MessageSourceAware, ResourceLoaderAware, ContextAware, ValangBased
- Direct Known Subclasses:
- ValangConditionExpressionParser, ValangFunctionExpressionParser, ValangValidator
public class SimpleValangBased
- extends BasicContextAware
- implements ValangBased
A simple implementation of ValangBased
.
- Author:
- Uri Boness
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleValangBased
public SimpleValangBased()
setCustomFunctions
public void setCustomFunctions(Map functionByName)
- Description copied from interface:
ValangBased
- Sets custom functions that should be registered with the used
ValangParser
.
- Specified by:
setCustomFunctions
in interface ValangBased
- Parameters:
functionByName
- the custom functions where the key is the function name and the value is the function
class FQN.- See Also:
ValangBased.setCustomFunctions(java.util.Map)
addCustomFunction
public void addCustomFunction(String functionName,
String functionClassName)
- Description copied from interface:
ValangBased
- Adds the a new custom function to be used in the valang el.
- Specified by:
addCustomFunction
in interface ValangBased
- Parameters:
functionName
- The name of the function.functionClassName
- The fully qualified class name of the function.- See Also:
ValangBased.addCustomFunction(String, String)
setDateParsers
public void setDateParsers(Map parserByRegexp)
- Description copied from interface:
ValangBased
- Sets the date parser that should be registered with the used
ValangParser
.
- Specified by:
setDateParsers
in interface ValangBased
- Parameters:
parserByRegexp
- the date parsers where the key is the regexp associated with the parser and the value
is the parser class FQN.- See Also:
ValangBased.setDateParsers(java.util.Map)
getCustomFunctions
public Map getCustomFunctions()
getDateParsers
public Map getDateParsers()
createValangParser
public ValangParser createValangParser(String expression)
- Creates a new
ValangParser
that is already configured with the proper custom functions and date
parsers.
- Parameters:
expression
- Valang language validation expression.
- Returns:
- A new
ValangParser
.
createValangParser
public ValangParser createValangParser(String expression,
String className)
- Creates a new
ValangParser
that is already configured with the proper custom functions and date
parsers and uses the class name to perform bytecode generation to avoid reflection.
- Parameters:
expression
- Valang language validation expression.className
- Name of the Class
to generated
a Function
to retrieve a property.
- Returns:
- A new
ValangParser
.
initValang
public void initValang(Object object)
getAllCustomFunctions
public Map getAllCustomFunctions()
- Returns all the custom functions that can be found. This method returns all the custom functions
that were explicitly registered with this instance and all custom functions that can be found in the
application context (if one is set) by looking for
FunctionDefinition
beans.
- Returns:
- All the custom function that can be found.
findAllCustomFunctionsInApplicationContext
protected Map findAllCustomFunctionsInApplicationContext()
Copyright © 2009. All Rights Reserved.