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 java.lang.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
AbstractFunction(Function[] arguments, int line, int column)
          Sub classes must implement this constructor.
 
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  java.lang.Object doGetResult(java.lang.Object target)
           
 Function[] getArguments()
           
 java.lang.Object getResult(java.lang.Object target)
          Gets the result of the function.
protected  FunctionTemplate getTemplate()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFunction

public AbstractFunction(Function[] arguments,
                        int line,
                        int column)
Sub classes must implement this constructor.

Method Detail

getArguments

public Function[] getArguments()

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.


getTemplate

protected FunctionTemplate getTemplate()

getResult

public final java.lang.Object getResult(java.lang.Object target)
Description copied from interface: Function

Gets the result of the function.

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

doGetResult

protected abstract java.lang.Object doGetResult(java.lang.Object target)
                                         throws java.lang.Exception
Throws:
java.lang.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 java.lang.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:
java.lang.Exception


Copyright © 2005. All Rights Reserved.