Class ExpressionFactory
- java.lang.Object
-
- org.vedantatree.expressionoasis.expressions.ExpressionFactory
-
public class ExpressionFactory extends Object
This is the expression factory which creates the expression for given expression token. It picks the mapping of tokens and corresponding expression classes from a XML file.- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description static String
BINARY
This is the binary expression type.static String
FUNCTION
This is the function expression type.static String
OPERAND
This is the operand expression type.static String
TRUE
This is the true constant for absolute.static String
UNARY
This is the unary expression type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFunction(String functionName)
Deprecated.No need to add function in ExpressionFactory, as it will always return FunctionExpression for all functionsExpression
createExpression(String expressionToken, String type)
Creates the expression object for given expression token and expression typestatic ExpressionFactory
getInstance()
Gets the shared instance of Expression Factory
-
-
-
Field Detail
-
UNARY
public static final String UNARY
This is the unary expression type- See Also:
- Constant Field Values
-
BINARY
public static final String BINARY
This is the binary expression type.- See Also:
- Constant Field Values
-
FUNCTION
public static final String FUNCTION
This is the function expression type.- See Also:
- Constant Field Values
-
OPERAND
public static final String OPERAND
This is the operand expression type.- See Also:
- Constant Field Values
-
TRUE
public static final String TRUE
This is the true constant for absolute.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static ExpressionFactory getInstance()
Gets the shared instance of Expression Factory- Returns:
- Returns the shared instance
-
addFunction
public void addFunction(String functionName)
Deprecated.No need to add function in ExpressionFactory, as it will always return FunctionExpression for all functionsAdds a function expression for the specified function name- Parameters:
name
- name of the function to add
-
createExpression
public Expression createExpression(String expressionToken, String type) throws ExpressionEngineException
Creates the expression object for given expression token and expression type- Parameters:
expressionToken
- the token of expressiontype
- the type of expression i.e. operand, operator etc- Returns:
- the expression object
- Throws:
ExpressionEngineException
- if anything goes wrong
-
-