org.springmodules.validation.valang.functions
Class AbstractFunction

java.lang.Object
  extended by org.springmodules.validation.valang.functions.AbstractFunction
All Implemented Interfaces:
Function
Direct Known Subclasses:
EmailFunction, InRoleFunction, LengthOfFunction, LowerCaseFunction, NotFunction, RegExFunction, ResolveFunction, UpperCaseFunction

public abstract class AbstractFunction
extends Object
implements Function

Base class for functions. Function classes should extend this class.

The lifecyle of a function that extends this class is:

Function implementations can implement any of the Spring callback interfaces listed above to get access to the specific objects.

Since:
Apr 23, 2005
Author:
Steven Devijver

Constructor Summary
protected AbstractFunction()
          Constructor
  AbstractFunction(Function[] arguments, int line, int column)
          Constructor Note: Sub classes must implement this constructor unless they implement ConfigurableConstructor.
 
Method Summary
protected  void definedExactNumberOfArguments(int exactNumberOfArguments)
          Call this method in the constructor of custom functions to define the exact number of arguments.
protected  void definedMaxNumberOfArguments(int maxNumberOfArguments)
          Call this method in the constructor of custom functions to define the maximum number of arguments.
protected  void definedMinNumberOfArguments(int minNumberOfArguments)
          Call this method in the constructor of custom functions to define the minimum number of arguments.
protected abstract  Object doGetResult(Object target)
          Processes result for subclasses.
 Function[] getArguments()
          Gets arguments
 Object getResult(Object target)
          Gets result.
protected  FunctionTemplate getTemplate()
          Gets template.
 void init()
          This method is called when all properties have been set through autowiring.
 boolean isAutowireByName()
          If true properties of function will be autowired by name by the Spring bean factory.
 boolean isAutowireByType()
          If true properties of function will be autowired by type by the Spring bean factory.
protected  void setArguments(Function[] arguments)
          Sets arguments.
protected  void setTemplate(FunctionTemplate template)
          Sets template.
protected  void setTemplate(int line, int column)
          Sets template with line and row number by creating a new FunctionTemplate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFunction

protected AbstractFunction()
Constructor


AbstractFunction

public AbstractFunction(Function[] arguments,
                        int line,
                        int column)

Constructor

Note: Sub classes must implement this constructor unless they implement ConfigurableConstructor.

Method Detail

getArguments

public Function[] getArguments()
Gets arguments


setArguments

protected void setArguments(Function[] arguments)
Sets arguments.


getTemplate

protected FunctionTemplate getTemplate()
Gets template.


setTemplate

protected void setTemplate(FunctionTemplate template)
Sets template.


setTemplate

protected void setTemplate(int line,
                           int column)
Sets template with line and row number by creating a new FunctionTemplate.


definedMinNumberOfArguments

protected void definedMinNumberOfArguments(int minNumberOfArguments)
Call this method in the constructor of custom functions to define the minimum number of arguments.


definedMaxNumberOfArguments

protected void definedMaxNumberOfArguments(int maxNumberOfArguments)
Call this method in the constructor of custom functions to define the maximum number of arguments.


definedExactNumberOfArguments

protected void definedExactNumberOfArguments(int exactNumberOfArguments)
Call this method in the constructor of custom functions to define the exact number of arguments.


getResult

public final Object getResult(Object target)
Gets result. Implementation of Function.

Specified by:
getResult in interface Function
Parameters:
target - the target bean
Returns:
the result of the function

doGetResult

protected abstract Object doGetResult(Object target)
                               throws Exception
Processes result for subclasses.

Throws:
Exception

isAutowireByType

public boolean isAutowireByType()
If true properties of function will be autowired by type by the Spring bean factory.


isAutowireByName

public boolean isAutowireByName()
If true properties of function will be autowired by name by the Spring bean factory.


init

public void init()
          throws Exception
This method is called when all properties have been set through autowiring. This method can be implemented to initialize resources or verify if mandatory properties have been set.

Throws:
Exception


Copyright © 2009. All Rights Reserved.