Class TreeMethodExpression

    • Constructor Summary

      Constructors 
      Constructor Description
      TreeMethodExpression​(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, java.lang.String expr, java.lang.Class<?> returnType, java.lang.Class<?>[] paramTypes)
      Create a new method expression.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dump​(java.io.PrintWriter writer)
      Print the parse tree.
      boolean equals​(java.lang.Object obj)
      Expressions are compared using the concept of a structural id: variable and function names are anonymized such that two expressions with same tree structure will also have the same structural id and vice versa.
      java.lang.String getExpressionString()  
      javax.el.MethodInfo getMethodInfo​(javax.el.ELContext context)
      Evaluates the expression and answers information about the method
      private java.lang.String getStructuralId()  
      int hashCode()  
      java.lang.Object invoke​(javax.el.ELContext context, java.lang.Object[] paramValues)
      Evaluates the expression and invokes the method.
      boolean isDeferred()
      Answer true if this is a deferred expression (starting with #{)
      boolean isLiteralText()  
      boolean isParmetersProvided()  
      private void readObject​(java.io.ObjectInputStream in)  
      java.lang.String toString()  
      • Methods inherited from class javax.el.MethodExpression

        isParametersProvided
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • bindings

        private final Bindings bindings
      • expr

        private final java.lang.String expr
      • type

        private final java.lang.Class<?> type
      • types

        private final java.lang.Class<?>[] types
      • deferred

        private final boolean deferred
      • structure

        private java.lang.String structure
    • Constructor Detail

      • TreeMethodExpression

        public TreeMethodExpression​(TreeStore store,
                                    javax.el.FunctionMapper functions,
                                    javax.el.VariableMapper variables,
                                    TypeConverter converter,
                                    java.lang.String expr,
                                    java.lang.Class<?> returnType,
                                    java.lang.Class<?>[] paramTypes)
        Create a new method expression. The expression must be an lvalue expression or literal text. The expected return type may be null, meaning "don't care". If it is an lvalue expression, the parameter types must not be null. If it is literal text, the expected return type must not be void.
        Parameters:
        store - used to get the parse tree from.
        functions - the function mapper used to bind functions
        variables - the variable mapper used to bind variables
        expr - the expression string
        returnType - the expected return type (may be null)
        paramTypes - the expected parameter types (must not be null for lvalues)
    • Method Detail

      • getStructuralId

        private java.lang.String getStructuralId()
      • getMethodInfo

        public javax.el.MethodInfo getMethodInfo​(javax.el.ELContext context)
                                          throws javax.el.ELException
        Evaluates the expression and answers information about the method
        Specified by:
        getMethodInfo in class javax.el.MethodExpression
        Parameters:
        context - used to resolve properties (base.property and base[property])
        Returns:
        method information or null for literal expressions
        Throws:
        javax.el.ELException - if evaluation fails (e.g. suitable method not found)
      • getExpressionString

        public java.lang.String getExpressionString()
        Specified by:
        getExpressionString in class javax.el.Expression
      • invoke

        public java.lang.Object invoke​(javax.el.ELContext context,
                                       java.lang.Object[] paramValues)
                                throws javax.el.ELException
        Evaluates the expression and invokes the method.
        Specified by:
        invoke in class javax.el.MethodExpression
        Parameters:
        context - used to resolve properties (base.property and base[property])
        paramValues -
        Returns:
        method result or null if this is a literal text expression
        Throws:
        javax.el.ELException - if evaluation fails (e.g. suitable method not found)
      • isLiteralText

        public boolean isLiteralText()
        Specified by:
        isLiteralText in class javax.el.Expression
        Returns:
        true if this is a literal text expression
      • isParmetersProvided

        public boolean isParmetersProvided()
        Overrides:
        isParmetersProvided in class javax.el.MethodExpression
        Returns:
        true if this is a method invocation expression
      • isDeferred

        public boolean isDeferred()
        Answer true if this is a deferred expression (starting with #{)
      • equals

        public boolean equals​(java.lang.Object obj)
        Expressions are compared using the concept of a structural id: variable and function names are anonymized such that two expressions with same tree structure will also have the same structural id and vice versa. Two method expressions are equal if
        1. their builders are equal
        2. their structural id's are equal
        3. their bindings are equal
        4. their expected types match
        5. their parameter types are equal
        Specified by:
        equals in class javax.el.Expression
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class javax.el.Expression
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • dump

        public void dump​(java.io.PrintWriter writer)
        Print the parse tree.
        Parameters:
        writer -
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException