org.apache.shale.test.el
Class MockValueExpression

java.lang.Object
  extended by javax.el.Expression
      extended by javax.el.ValueExpression
          extended by org.apache.shale.test.el.MockValueExpression
All Implemented Interfaces:
Serializable

public class MockValueExpression
extends javax.el.ValueExpression

Mock implementation of ValueExpression.

This implementation supports a limited subset of overall expression functionality:

See Also:
Serialized Form

Constructor Summary
MockValueExpression(String expression, Class expectedType)
          Construct a new expression for the specified expression string.
 
Method Summary
 boolean equals(Object obj)
          Return true if this expression is equal to the specified expression.
 Class getExpectedType()
          Return the type that the result of this expression will be coerced to.
 String getExpressionString()
          Return the original String used to create this expression, unmodified.
 Class getType(javax.el.ELContext context)
          Evaluate this expression relative to the specified context, and return the most general type that is acceptable for the value passed in a setValue() call.
 Object getValue(javax.el.ELContext context)
          Evaluate this expression relative to the specified context, and return the result.
 int hashCode()
          Return the hash code for this expression.
 boolean isLiteralText()
          Return true if the expression string for this expression contains only literal text.
 boolean isReadOnly(javax.el.ELContext context)
          Evaluate this expression relative to the specified context, and return true if a call to setValue() will always fail.
 void setValue(javax.el.ELContext context, Object value)
          Evaluate this expression relative to the specified context, and set the result to the specified value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockValueExpression

public MockValueExpression(String expression,
                           Class expectedType)

Construct a new expression for the specified expression string.

Parameters:
expression - Expression string to be evaluated
expectedType - Expected type of the result
Method Detail

equals

public boolean equals(Object obj)

Return true if this expression is equal to the specified expression.

Specified by:
equals in class javax.el.Expression
Parameters:
obj - Object to be compared

getExpressionString

public String getExpressionString()

Return the original String used to create this expression, unmodified.

Specified by:
getExpressionString in class javax.el.Expression

hashCode

public int hashCode()

Return the hash code for this expression.

Specified by:
hashCode in class javax.el.Expression

isLiteralText

public boolean isLiteralText()

Return true if the expression string for this expression contains only literal text.

Specified by:
isLiteralText in class javax.el.Expression

getExpectedType

public Class getExpectedType()

Return the type that the result of this expression will be coerced to.

Specified by:
getExpectedType in class javax.el.ValueExpression

getType

public Class getType(javax.el.ELContext context)

Evaluate this expression relative to the specified context, and return the most general type that is acceptable for the value passed in a setValue() call.

Specified by:
getType in class javax.el.ValueExpression
Parameters:
context - ELContext for this evaluation

getValue

public Object getValue(javax.el.ELContext context)

Evaluate this expression relative to the specified context, and return the result.

Specified by:
getValue in class javax.el.ValueExpression
Parameters:
context - ELContext for this evaluation

isReadOnly

public boolean isReadOnly(javax.el.ELContext context)

Evaluate this expression relative to the specified context, and return true if a call to setValue() will always fail.

Specified by:
isReadOnly in class javax.el.ValueExpression
Parameters:
context - ELContext for this evaluation

setValue

public void setValue(javax.el.ELContext context,
                     Object value)

Evaluate this expression relative to the specified context, and set the result to the specified value.

Specified by:
setValue in class javax.el.ValueExpression
Parameters:
context - ELContext for this evaluation
value - Value to which the result should be set


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.