net.sf.jec
Class AccessorOperator

java.lang.Object
  extended bynet.sf.jec.Operator
      extended bynet.sf.jec.InvertibleOperator
          extended bynet.sf.jec.AccessorOperator

public class AccessorOperator
extends InvertibleOperator

This operator returns/sets a property of the context object. The actual "property" definition depends on the context object class:

Author:
mballesteros

Field Summary
 
Fields inherited from class net.sf.jec.Operator
argOps, nestedOp, showFunctionString
 
Constructor Summary
AccessorOperator(java.lang.String field, boolean throwExceptions)
          Creates a new AccessorOperator that will try to get and set the field property of the context
AccessorOperator(java.lang.String field, Operator nestedOp, boolean throwExceptions)
          Creates a new AccessorOperator that will try to get and set the field property of the context
 
Method Summary
protected  java.lang.Object directMap(java.lang.Object rootCtx, java.lang.Object ctx)
          Returns the associated value to the given context and root context
protected  void inverseMap(java.lang.Object rootCtx, java.lang.Object ctx, java.lang.Object value)
          Sets the given value if this operator is at the end of the operator chain or just resolves the context object and passes it to the next operator in the chain.
 java.lang.String toExpressionString()
          Returns an expression String representation for this operator
 java.lang.String toFunctionString()
          Returns a function representation String for this operator
 
Methods inherited from class net.sf.jec.InvertibleOperator
applyInverse
 
Methods inherited from class net.sf.jec.Operator
apply, setArgumentOperators, setNestedOperator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccessorOperator

public AccessorOperator(java.lang.String field,
                        boolean throwExceptions)
Creates a new AccessorOperator that will try to get and set the field property of the context

Parameters:
field - The field that will be accessed
throwExceptions -

AccessorOperator

public AccessorOperator(java.lang.String field,
                        Operator nestedOp,
                        boolean throwExceptions)
Creates a new AccessorOperator that will try to get and set the field property of the context

Parameters:
field - The field that will be accessed
nestedOp - The nested operator
throwExceptions -
Method Detail

toFunctionString

public java.lang.String toFunctionString()
Returns a function representation String for this operator

Specified by:
toFunctionString in class Operator
Returns:
A String representation in a Function like style

toExpressionString

public java.lang.String toExpressionString()
Returns an expression String representation for this operator

Specified by:
toExpressionString in class Operator
Returns:
A String representation in an expression like style

directMap

protected java.lang.Object directMap(java.lang.Object rootCtx,
                                     java.lang.Object ctx)
                              throws EvaluationException
Returns the associated value to the given context and root context

Specified by:
directMap in class Operator
Parameters:
rootCtx - The root context, needed for operators that require expression evaluation from root point. Example: Indexer operators
ctx - The current context where the operator will work over
Returns:
The direct mapping of this operator on the given context
Throws:
EvaluationException - Thrown if there's an evaluation problem

inverseMap

protected void inverseMap(java.lang.Object rootCtx,
                          java.lang.Object ctx,
                          java.lang.Object value)
                   throws EvaluationException
Sets the given value if this operator is at the end of the operator chain or just resolves the context object and passes it to the next operator in the chain.

Specified by:
inverseMap in class InvertibleOperator
Parameters:
rootCtx - The root context, needed for operators that require expression evaluation from root point. Example: Indexer operators
ctx - The current context where the operator will work over
value - The value to set.
Throws:
EvaluationException - Thrown if there's an evaluation problem


Copyright © 2003 SourceForge. All Rights Reserved.