Class TreeValueExpression

    • Constructor Summary

      Constructors 
      Constructor Description
      TreeValueExpression​(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, java.lang.String expr, java.lang.Class<?> type)
      Create a new value 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.Class<?> getExpectedType()  
      java.lang.String getExpressionString()  
      private java.lang.String getStructuralId()  
      java.lang.Class<?> getType​(javax.el.ELContext context)
      Evaluates the expression as an lvalue and answers the result type.
      java.lang.Object getValue​(javax.el.ELContext context)
      Evaluates the expression as an rvalue and answers the result.
      javax.el.ValueReference getValueReference​(javax.el.ELContext context)  
      int hashCode()  
      boolean isDeferred()
      Answer true if this is a deferred expression (containing sub-expressions starting with #{)
      boolean isLeftValue()
      Answer true if this could be used as an lvalue.
      boolean isLiteralText()  
      boolean isReadOnly​(javax.el.ELContext context)
      Evaluates the expression as an lvalue and determines if setValue(ELContext, Object) will always fail.
      private void readObject​(java.io.ObjectInputStream in)  
      void setValue​(javax.el.ELContext context, java.lang.Object value)
      Evaluates the expression as an lvalue and assigns the given value.
      java.lang.String toString()  
      • 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
      • deferred

        private final boolean deferred
      • structure

        private java.lang.String structure
    • Constructor Detail

      • TreeValueExpression

        public TreeValueExpression​(TreeStore store,
                                   javax.el.FunctionMapper functions,
                                   javax.el.VariableMapper variables,
                                   TypeConverter converter,
                                   java.lang.String expr,
                                   java.lang.Class<?> type)
        Create a new value expression.
        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
        type - the expected type (may be null)
    • Method Detail

      • getStructuralId

        private java.lang.String getStructuralId()
      • getExpectedType

        public java.lang.Class<?> getExpectedType()
        Specified by:
        getExpectedType in class javax.el.ValueExpression
      • getExpressionString

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

        public java.lang.Class<?> getType​(javax.el.ELContext context)
                                   throws javax.el.ELException
        Evaluates the expression as an lvalue and answers the result type.
        Specified by:
        getType in class javax.el.ValueExpression
        Parameters:
        context - used to resolve properties (base.property and base[property]) and to determine the result from the last base/property pair
        Returns:
        lvalue evaluation type or null for rvalue expressions
        Throws:
        javax.el.ELException - if evaluation fails (e.g. property not found, type conversion failed, ...)
      • getValue

        public java.lang.Object getValue​(javax.el.ELContext context)
                                  throws javax.el.ELException
        Evaluates the expression as an rvalue and answers the result.
        Specified by:
        getValue in class javax.el.ValueExpression
        Parameters:
        context - used to resolve properties (base.property and base[property]) and to determine the result from the last base/property pair
        Returns:
        rvalue evaluation result
        Throws:
        javax.el.ELException - if evaluation fails (e.g. property not found, type conversion failed, ...)
      • isReadOnly

        public boolean isReadOnly​(javax.el.ELContext context)
                           throws javax.el.ELException
        Evaluates the expression as an lvalue and determines if setValue(ELContext, Object) will always fail.
        Specified by:
        isReadOnly in class javax.el.ValueExpression
        Parameters:
        context - used to resolve properties (base.property and base[property]) and to determine the result from the last base/property pair
        Returns:
        true if setValue(ELContext, Object) always fails.
        Throws:
        javax.el.ELException - if evaluation fails (e.g. property not found, type conversion failed, ...)
      • setValue

        public void setValue​(javax.el.ELContext context,
                             java.lang.Object value)
                      throws javax.el.ELException
        Evaluates the expression as an lvalue and assigns the given value.
        Specified by:
        setValue in class javax.el.ValueExpression
        Parameters:
        context - used to resolve properties (base.property and base[property]) and to perform the assignment to the last base/property pair
        Throws:
        javax.el.ELException - if evaluation fails (e.g. property not found, type conversion failed, assignment failed...)
      • isLiteralText

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

        public javax.el.ValueReference getValueReference​(javax.el.ELContext context)
        Overrides:
        getValueReference in class javax.el.ValueExpression
      • isLeftValue

        public boolean isLeftValue()
        Answer true if this could be used as an lvalue. This is the case for eval expressions consisting of a simple identifier or a nonliteral prefix, followed by a sequence of property operators (. or [])
      • isDeferred

        public boolean isDeferred()
        Answer true if this is a deferred expression (containing sub-expressions 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 value expressions are equal if
        1. their structural id's are equal
        2. their bindings are equal
        3. their expected 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