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
public abstract class AbstractFunction extends java.lang.Object implements ExpressionItem
The abstract class is the base for each function handler in the preprocessor
-
-
Field Summary
Fields Modifier and Type Field Description static AbstractFunction[]
ALL_FUNCTIONS
Inside array contains all functions supported by the preprocessorstatic java.lang.String
EXECUTION_PREFIX
The string contains the prefix for all executing methods of functionsstatic java.util.Map<java.lang.String,AbstractFunction>
FUNCTION_NAME_MAP
protected static java.util.concurrent.atomic.AtomicLong
UID_COUNTER
Inside counter to generate UID for some cases
-
Constructor Summary
Constructors Constructor Description AbstractFunction()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <E extends AbstractFunction>
EfindForClass(java.lang.Class<E> functionClass)
Allows to find a function handler instance for its classstatic AbstractFunction
findForName(java.lang.String str)
Find a function handler for its nameabstract ValueType[][]
getAllowedArgumentTypes()
Get arrays of supported argument typesabstract int
getArity()
Get the function arityExpressionItemPriority
getExpressionItemPriority()
Get the priority of the function in the expression treeExpressionItemType
getExpressionItemType()
Get the expression item typeabstract java.lang.String
getName()
Get the function nameabstract java.lang.String
getReference()
Get the function reference to be output for a help requestabstract ValueType
getResultType()
Get the result typejava.lang.String
toString()
-
-
-
Field Detail
-
EXECUTION_PREFIX
public static final java.lang.String EXECUTION_PREFIX
The string contains the prefix for all executing methods of functions- See Also:
- Constant Field Values
-
ALL_FUNCTIONS
public static final AbstractFunction[] ALL_FUNCTIONS
Inside array contains all functions supported by the preprocessor
-
FUNCTION_NAME_MAP
public static final java.util.Map<java.lang.String,AbstractFunction> FUNCTION_NAME_MAP
-
UID_COUNTER
protected static final java.util.concurrent.atomic.AtomicLong UID_COUNTER
Inside counter to generate UID for some cases
-
-
Method Detail
-
findForClass
public static <E extends AbstractFunction> E findForClass(java.lang.Class<E> functionClass)
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
public static AbstractFunction findForName(java.lang.String str)
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
public abstract java.lang.String getName()
Get the function name- Returns:
- the function name in lower case, must not be null
-
getReference
public abstract java.lang.String 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
@MustNotContainNull public abstract ValueType[][] getAllowedArgumentTypes()
Get arrays of supported argument types- Returns:
- the array of argument type combinations allowed by the function handler, must not be null
-
getResultType
public abstract ValueType getResultType()
Get the result type- Returns:
- the result type of the function, must not be null
-
getExpressionItemPriority
public ExpressionItemPriority 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
public ExpressionItemType 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-