Class AbstractFunction
java.lang.Object
com.igormaznitsa.jcp.expression.functions.AbstractFunction
- All Implemented Interfaces:
ExpressionItem
- Direct Known Subclasses:
AbstractStrConverter
,AbstractXMLFunction
,FunctionABS
,FunctionBINFILE
,FunctionDefinedByUser
,FunctionEVALFILE
,FunctionIS
,FunctionISSUBSTR
,FunctionROUND
,FunctionSTR2GO
,FunctionSTR2JAVA
,FunctionSTRLEN
The abstract class is the base for each function handler in the preprocessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AbstractFunction[]
Inside array contains all functions supported by the preprocessorstatic final String
The string contains the prefix for all executing methods of functionsstatic final Map
<String, AbstractFunction> protected static final AtomicLong
Inside counter to generate UID for some cases -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends AbstractFunction>
EfindForClass
(Class<E> functionClass) Allows to find a function handler instance for its classstatic AbstractFunction
findForName
(String str) Find a function handler for its nameabstract ValueType[][]
Get arrays of supported argument typesabstract int
getArity()
Get the function arityGet the priority of the function in the expression treeGet the expression item typeabstract String
getName()
Get the function nameabstract String
Get the function reference to be output for a help requestabstract ValueType
Get the result typetoString()
-
Field Details
-
EXECUTION_PREFIX
The string contains the prefix for all executing methods of functions- See Also:
-
ALL_FUNCTIONS
Inside array contains all functions supported by the preprocessor -
FUNCTION_NAME_MAP
-
UID_COUNTER
Inside counter to generate UID for some cases
-
-
Constructor Details
-
AbstractFunction
public AbstractFunction()
-
-
Method Details
-
findForClass
Allows to find a function handler instance for its class- Type Parameters:
E
- the class of the needed function handler extends the AbstractFunction class- Parameters:
functionClass
- the class of the needed handler, must not be null- Returns:
- an instance of the needed handler or null if there is not any such one
-
findForName
Find a function handler for its name- Parameters:
str
- the function name, must not be null- Returns:
- an instance of the needed handler or null if there is not any such one
-
getName
Get the function name- Returns:
- the function name in lower case, must not be null
-
getReference
Get the function reference to be output for a help request- Returns:
- the function information as a String, must not be null
-
getArity
public abstract int getArity()Get the function arity- Returns:
- the function arity (zero or greater)
-
getAllowedArgumentTypes
Get arrays of supported argument types- Returns:
- the array of argument type combinations allowed by the function handler, must not be null
-
getResultType
Get the result type- Returns:
- the result type of the function, must not be null
-
getExpressionItemPriority
Get the priority of the function in the expression tree- Specified by:
getExpressionItemPriority
in interfaceExpressionItem
- Returns:
- the expression item priority for the function, must not be null
-
getExpressionItemType
Get the expression item type- Specified by:
getExpressionItemType
in interfaceExpressionItem
- Returns:
- the expression item type, in the case it is always ExpressionItemType.FUNCTION
-
toString
-