Class ObjectValueExpression

  • All Implemented Interfaces:
    java.io.Serializable

    public final class ObjectValueExpression
    extends ValueExpression
    Object wrapper expression.
    Author:
    Christoph Beck
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectValueExpression​(TypeConverter converter, java.lang.Object object, java.lang.Class<?> type)
      Wrap an object into a value expression.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Two object value expressions are equal if and only if their wrapped objects are equal.
      java.lang.Class<?> getExpectedType()
      Returns the type the result of the expression will be coerced to after evaluation.
      java.lang.String getExpressionString()
      Answer null.
      java.lang.Class<?> getType​(ELContext context)
      Answer null.
      java.lang.Object getValue​(ELContext context)
      Answer the wrapped object, coerced to the expected type.
      int hashCode()
      Returns the hash code for this Expression.
      boolean isLiteralText()
      Answer false.
      boolean isReadOnly​(ELContext context)
      Answer true.
      void setValue​(ELContext context, java.lang.Object value)
      Throw an exception.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • ObjectValueExpression

        public ObjectValueExpression​(TypeConverter converter,
                                     java.lang.Object object,
                                     java.lang.Class<?> type)
        Wrap an object into a value expression.
        Parameters:
        converter - type converter
        object - the object to wrap
        type - the expected type this object will be coerced in getValue(ELContext).
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Two object value expressions are equal if and only if their wrapped objects are equal.
        Specified by:
        equals in class Expression
        Parameters:
        obj - the Object to test for equality.
        Returns:
        true if obj equals this Expression; false otherwise.
      • hashCode

        public int hashCode()
        Description copied from class: Expression
        Returns the hash code for this Expression. See the note in the Expression.equals(Object) method on how two expressions can be equal if their expression Strings are different. Recall that if two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. Implementations must take special note and implement hashCode correctly.
        Specified by:
        hashCode in class Expression
        Returns:
        The hash code for this Expression.
        See Also:
        Expression.equals(Object), Hashtable, Object.hashCode()
      • getValue

        public java.lang.Object getValue​(ELContext context)
        Answer the wrapped object, coerced to the expected type.
        Specified by:
        getValue in class ValueExpression
        Parameters:
        context - The context of this evaluation.
        Returns:
        The result of the expression evaluation.
      • getExpressionString

        public java.lang.String getExpressionString()
        Answer null.
        Specified by:
        getExpressionString in class Expression
        Returns:
        The original expression String.
      • isLiteralText

        public boolean isLiteralText()
        Answer false.
        Specified by:
        isLiteralText in class Expression
        Returns:
        true if this expression was created from only literal text; false otherwise.
      • getType

        public java.lang.Class<?> getType​(ELContext context)
        Answer null.
        Specified by:
        getType in class ValueExpression
        Parameters:
        context - The context of this evaluation.
        Returns:
        the most general acceptable type; otherwise undefined.
      • isReadOnly

        public boolean isReadOnly​(ELContext context)
        Answer true.
        Specified by:
        isReadOnly in class ValueExpression
        Parameters:
        context - The context of this evaluation.
        Returns:
        true if the expression is read-only or false if not.
      • setValue

        public void setValue​(ELContext context,
                             java.lang.Object value)
        Throw an exception.
        Specified by:
        setValue in class ValueExpression
        Parameters:
        context - The context of this evaluation.
        value - The new value to be set.
      • toString

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

        public java.lang.Class<?> getExpectedType()
        Description copied from class: ValueExpression
        Returns the type the result of the expression will be coerced to after evaluation.
        Specified by:
        getExpectedType in class ValueExpression
        Returns:
        the expectedType passed to the ExpressionFactory.createValueExpression method that created this ValueExpression.