ru.onego.industrial.catalog.util
Interface FunctionInterface

All Known Implementing Classes:
LeftFunction, ReplaceAllFunction, ReplaceFunction, TrimFunction, UppercaseFunction

public interface FunctionInterface

Specifies interface of the value processing function.

Version:
1.0
Author:
Lev Levin

Method Summary
 java.lang.Object exec(java.util.List params)
          Core method.
 java.lang.String getName()
          Return name of this function.
 int getParamCount()
          Returns number of function parameters.
 java.lang.Class getParamType(int param)
          Returns type of parameter, specified by the index.
 

Method Detail

getName

java.lang.String getName()
Return name of this function.

Returns:
Name of the function

getParamCount

int getParamCount()
                  throws FunctionException
Returns number of function parameters.

Returns:
Number of parameters
Throws:
FunctionException - Thrown if something goes wrong

getParamType

java.lang.Class getParamType(int param)
                             throws FunctionException
Returns type of parameter, specified by the index. Parameters should be convertible t the results of this method.

Parameters:
param - Index of the parameter
Returns:
Class representing type of parameter
Throws:
FunctionException - Thrown if index out of bounbds

exec

java.lang.Object exec(java.util.List params)
                      throws FunctionException
Core method. Executes function with the given parameters. First parameter is always value which should be treated.

Parameters:
params - List of function parameters
Returns:
Treated value
Throws:
FunctionException - Thrown if any error occur while executing function