public final class CustomFunctionProvider extends Object implements FunctionProvider
| Modifier and Type | Field and Description |
|---|---|
static String |
POW
The provided composite 'POW' function.
|
static String |
SQRT
The provided composite 'SQRT' function.
|
| Constructor and Description |
|---|
CustomFunctionProvider() |
| Modifier and Type | Method and Description |
|---|---|
Type |
getFunctionType(String functionName,
Type[] parameterTypes)
Gets the return type of the function.
|
ValueObject |
getFunctionValue(String functionName,
ValueObject[] parameters)
Gets the return value of function.
|
void |
initialize(ExpressionContext expressionContext)
It initialize the Function provider with expression context and also
gives a chance to pre-initialize any internal states for operations
|
boolean |
supportsFunction(String functionName,
Type[] parameterTypes)
Checks whether the this function provider supports any function or not.
|
public static final String POW
public static final String SQRT
public void initialize(ExpressionContext expressionContext)
FunctionProviderinitialize in interface FunctionProviderexpressionContext - Context of current expression evaluation processAssertionError - In case the passed ExpressionContext is not a
CustomExpressionContext instance.public Type getFunctionType(String functionName, Type[] parameterTypes) throws ExpressionEngineException
FunctionProvidergetFunctionType in interface FunctionProviderfunctionName - the name of the function.parameterTypes - the types of the parametersType.DOUBLE in case supportsFunction(String, Type[]) called with the
given arguments returns true, otherwise null.ExpressionEngineException - if anything goes wrongpublic ValueObject getFunctionValue(String functionName, ValueObject[] parameters) throws ExpressionEngineException
getFunctionValue in interface FunctionProviderfunctionName - the name of the functionparameters - the parameters values of the functionnull is returned in case the function denoted by the given name is not
provided by this instance.ValueObject of Type.DOUBLE is returned if none of the
parameters is a MeasuredFactor.MeasuredValuesCompositeValueObject is returned in any other case.ExpressionEngineException - if anything goes wrongpublic boolean supportsFunction(String functionName, Type[] parameterTypes) throws ExpressionEngineException
FunctionProvidersupportsFunction in interface FunctionProviderfunctionName - the name of the functionparameterTypes - the type of parameters for the functiontrue if function provider supports the function false otherwiseExpressionEngineException - if anything goes wrong