Class 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
    • 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 functions
        Adds 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 expression
        type - the type of expression i.e. operand, operator etc
        Returns:
        the expression object
        Throws:
        ExpressionEngineException - if anything goes wrong