Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.expression
Interface Expression

All Superinterfaces
  Cloneable, Serializable

All Known Subinterfaces:
  ProxyExpression

All Known Implementing Classes:
  ClassForName, ClassGetName, ClassNewInstance, CollectionContains, CollectionContainsAll, CollectionContainsAny, CollectionOperator, ComparativeOperator, com.bea.p13n.expression.internal.ComplexExpressionImpl, ContainedIn, Equals, GreaterOrEquals, GreaterThan, If, Instanceof, LessOrEquals, LessThan, LogicalAnd, LogicalMultiAnd, LogicalMultiOr, LogicalNot, LogicalOperator, LogicalOr, MathAbs, MathAcos, MathAdd, MathAsin, MathAtan, MathAtan2, MathCeil, MathCos, MathDivide, MathExp, MathFloor, MathIeeeRemainder, MathLog, MathMax, MathMin, MathMultiply, MathOperator, MathPow, MathRandom, MathRint, MathRound, MathSin, MathSqrt, MathSubtract, MathTan, MathToDegrees, MathToRadians, MethodCall, NotEquals, ObjectGetClass, ObjectHashCode, ObjectToString, Operator, PropertyRef, PropertyRef, RequestPropertyRef, RequestPropertyRef, SessionPropertyRef, SessionPropertyRef, StringCharAt, StringCompareToIgnoreCase, StringConcat, StringContains, StringEndsWith, StringEqualsIgnoreCase, StringLength, StringLike, StringOperator, StringReplace, StringStartsWith, StringSubstring, StringToLowerCase, StringToUpperCase, StringTrim, SystemCurrentTimeMillis, SystemGetProperty, UserPropertyRef, UserPropertyRef, Variable, VariableBinding

    public interface Expression

extends Serializable, Cloneable

An interface implemented by all simple and complex expressions. An expression is a runtime interpreted well formed piece of simple Java code ( all kinds of expressions, conditional statements, etc ). Expression objects can contain sub-expressions, sub-expressions can also be Java literals(Double, Float, Integer, etc). Expressions maintain parent information, children information, internal cache and a parameter signature.

Method Summary
`void` | `addSubExpression(Object object)` Adds the supplied object as a child of this expression.
`void` | `clearCache()` Clears any cached results to force re-evaluation.
`Object` | `clone()` Returns a clone of this.
`Object` | `getCachedValue()` Returns the cached value for this expression, if the cache is enabled for this expression.
`Class[]` | `getParameterSignature()` Returns the parameter signature for this `Expression`.
`Expression` | `getParent()` Returns the parent of this expression.
`Object` | `getSubExpression(int index)` Returns the sub-expression (child) at the specified position.
`int` | `getSubExpressionCount()` Returns the number of sub-expressions (children of this expression).
`boolean` | `isCached()` Returns `true` if this expression has a cached value.
`boolean` | `isCacheEnabled()` Returns true if this `Expression` is caching the result of evaluating this.
`void` | `removeAllSubExpressions()` Removes all the sub-expressions (children) of this.
`Object` | `removeSubExpression(int index)` Removes the (child) sub-expression at the specified position.
`boolean` | `removeSubExpression(Object object)` Removes the supplied (child) sub-expression.
`void` | `setCachedValue(Object obj)` Sets the given object that is the result of evaluating this expression as the cached result value for this expression.
`void` | `setCacheEnabled(boolean enable)` Enables the result caching for this `Expression`.
`void` | `setSubExpression(int index, Object object)` Replaces the sub-expression (child) at the specified position.
`void` | `write(PrintStream out)` Writes the expression (in text form) to an OutputStream.

Method Detail

### getParent

    Expression getParent()

  Returns the parent of this expression.

  Returns
    The parent of this.

### getSubExpression

    Object getSubExpression(int index)

  Returns the sub-expression (child) at the specified position.

  Parameters
    `index` - The index of the sub-expression (child) to return.
  Returns
    The sub-expression (child) at the supplied index.
  Throws
    `IndexOutOfBoundsException` - If the supplied index is invalid.

### setSubExpression

    void setSubExpression(int index,
                          Object object)

  Replaces the sub-expression (child) at the specified position.

  Note: If the given object (child) is an expression then it is replaced by `null` in the previous parent's children list.

  Parameters
    `index` - The index of the (child) sub-expression to replace.
    `object` - The new sub-expression (child) to be stored at the specified position.
  Throws
    `IndexOutOfBoundsException` - If the supplied index is invalid.

### removeSubExpression

    Object removeSubExpression(int index)

  Removes the (child) sub-expression at the specified position.

  Parameters
    `index` - The index of the (child) sub-expression to remove.
  Returns
    The removed (child) sub-expression.
  Throws
    `IndexOutOfBoundsException` - If the supplied index is invalid.

### removeSubExpression

    boolean removeSubExpression(Object object)

  Removes the supplied (child) sub-expression.

  Parameters
    `object` - The (child) sub-expression to remove.
  Returns
    `true` If the (child) sub-expression is removed successfully, otherwise `false`.

### removeAllSubExpressions

    void removeAllSubExpressions()

  Removes all the sub-expressions (children) of this.

### getSubExpressionCount

    int getSubExpressionCount()

  Returns the number of sub-expressions (children of this expression).

  Returns
    The number of sub-expressions

### addSubExpression

    void addSubExpression(Object object)

  Adds the supplied object as a child of this expression. If the supplied object is an instance of `Expression` and if it already has a parent, then a proxy expression will be created and added as a child of this expression.

  Parameters
    `object` - The object added as a child of this.
  See Also
    `ProxyExpression`

### getParameterSignature

    Class[] getParameterSignature()

  Returns the parameter signature for this `Expression`. Because the sub-expressions within the `Expression` are typically arguments or operands, some type validation is performed by examining the class types of the sub-expressions against the `Expression`'s parameter signature.
  The tests that are performed are:
  1. The number of sub-expressions must equals the number of parameter entries.
  2. The class type of any sub-expression (or the result of evaluating the sub-expresssion) must equal the class type of the corresponding parameter entry.
  3. Any null parameter entries are ignored and are considered optional sub-expressions.

  Returns
    the Class array containing the parameter signature.

### getCachedValue

    Object getCachedValue()

  Returns the cached value for this expression, if the cache is enabled for this expression.

  Returns
    the result of evaluating this expression.
  See Also
    `isCached()`

### setCachedValue

    void setCachedValue(Object obj)

  Sets the given object that is the result of evaluating this expression as the cached result value for this expression. The evaluate method will return the cached value if isCached() method returns true.

  Parameters
    `obj` - the value to be cached
  See Also
    `isCached()`

### isCached

    boolean isCached()

  Returns `true` if this expression has a cached value.

  Returns
    `true` If this expression has a cached value, otherwise `false`.

### setCacheEnabled

    void setCacheEnabled(boolean enable)

  Enables the result caching for this `Expression`.

  Parameters
    `enable` - `true` to enable the result caching.

### clearCache

    void clearCache()

  Clears any cached results to force re-evaluation. Should also call clearCache on any parent-expressions to force this `Expression` to be re-evaluated.

### isCacheEnabled

    boolean isCacheEnabled()

  Returns true if this `Expression` is caching the result of evaluating this.

  Returns
    `true` if caching is enabled otherwise `false`.

### write

    void write(PrintStream out)

  Writes the expression (in text form) to an OutputStream.

  Parameters
    `out` - A `PrintStream`.

### clone

    Object clone()
                 throws CloneNotSupportedException

  Returns a clone of this.

  Returns
    A clone of this.
  Throws
    `A` - `CloneNotSupportedException` if unable to clone this.
    `CloneNotSupportedException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.