Package ognl

Class Evaluation


  • public class Evaluation
    extends java.lang.Object
    An Evaluation is and object that holds a node being evaluated and the source from which that node will take extract its value. It refers to child evaluations that occur as a result of the nodes' evaluation.
    • Constructor Summary

      Constructors 
      Constructor Description
      Evaluation​(SimpleNode node, java.lang.Object source)
      Constructs a new "get" Evaluation from the node and source given.
      Evaluation​(SimpleNode node, java.lang.Object source, boolean setOperation)
      Constructs a new Evaluation from the node and source given.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(Evaluation child)
      Adds a child to the list of children of this evaluation.
      java.lang.Throwable getException()
      Returns the exception that occurred as a result of evaluating the Evaluation, or null if no exception occurred.
      Evaluation getFirstChild()
      Returns the first child of this evaluation.
      Evaluation getFirstDescendant()
      Gets the first descendent.
      Evaluation getLastChild()
      Returns the last child of this evaluation.
      Evaluation getLastDescendant()
      Gets the last descendent.
      Evaluation getNext()
      Returns the next sibling of this evaluation.
      SimpleNode getNode()
      Returns the SimpleNode for this Evaluation
      Evaluation getParent()
      Returns the parent evaluation of this evaluation.
      Evaluation getPrevious()
      Returns the previous sibling of this evaluation.
      java.lang.Object getResult()
      Returns the result of the Evaluation, or null if it was a set operation.
      java.lang.Object getSource()
      Returns the source object on which this Evaluation operated.
      void init​(SimpleNode node, java.lang.Object source, boolean setOperation)
      Reinitializes this Evaluation to the parameters specified.
      boolean isSetOperation()
      Returns true if this Evaluation represents a set operation.
      void reset()
      Resets this Evaluation to the initial state.
      void setException​(java.lang.Throwable value)
      Sets the exception that occurred as a result of evaluating the Evaluation.
      void setNode​(SimpleNode value)
      Sets the node of the evaluation.
      void setResult​(java.lang.Object value)
      Sets the result of the Evaluation.
      void setSetOperation​(boolean value)
      Marks the Evaluation as a set operation if the value is true, else marks it as a get operation.
      void setSource​(java.lang.Object value)
      Sets the source of the evaluation.
      java.lang.String toString()
      Returns a String description of the Evaluation.
      java.lang.String toString​(boolean compact, boolean showChildren, java.lang.String depth)
      Produces a String value for the Evaluation.
      java.lang.String toString​(boolean compact, java.lang.String depth)
      Produces a String value for the Evaluation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • source

        private java.lang.Object source
      • setOperation

        private boolean setOperation
      • result

        private java.lang.Object result
      • exception

        private java.lang.Throwable exception
    • Constructor Detail

      • Evaluation

        public Evaluation​(SimpleNode node,
                          java.lang.Object source)
        Constructs a new "get" Evaluation from the node and source given.
        Parameters:
        node - a SimpleNode for this Evaluation.
        source - a source Object for this Evaluation.
      • Evaluation

        public Evaluation​(SimpleNode node,
                          java.lang.Object source,
                          boolean setOperation)
        Constructs a new Evaluation from the node and source given. If setOperation is true this Evaluation represents a "set" as opposed to a "get".
        Parameters:
        node - a SimpleNode for this Evaluation.
        source - a source Object for this Evaluation.
        setOperation - true to identify this Evaluation as a set operation, false to identify it as a get operation.
    • Method Detail

      • getNode

        public SimpleNode getNode()
        Returns the SimpleNode for this Evaluation
        Returns:
        the SimpleNode for this Evaluation.
      • setNode

        public void setNode​(SimpleNode value)
        Sets the node of the evaluation. Normally applications do not need to set this. Notable exceptions to this rule are custom evaluators that choose between navigable objects (as in a multi-root evaluator where the navigable node is chosen at runtime).
        Parameters:
        value - the SimpleNode to set for this Evaluation.
      • getSource

        public java.lang.Object getSource()
        Returns the source object on which this Evaluation operated.
        Returns:
        the source Object operated upon by this Evaluation.
      • setSource

        public void setSource​(java.lang.Object value)
        Sets the source of the evaluation. Normally applications do not need to set this. Notable exceptions to this rule are custom evaluators that choose between navigable objects (as in a multi-root evaluator where the navigable node is chosen at runtime).
        Parameters:
        value - the source Object to be set for this Evaluation.
      • isSetOperation

        public boolean isSetOperation()
        Returns true if this Evaluation represents a set operation.
        Returns:
        true if this Evaluation represents a set operation, false otherwise.
      • setSetOperation

        public void setSetOperation​(boolean value)
        Marks the Evaluation as a set operation if the value is true, else marks it as a get operation.
        Parameters:
        value - true to identify this Evaluation as a set operation, false to identify it as a get operation.
      • getResult

        public java.lang.Object getResult()
        Returns the result of the Evaluation, or null if it was a set operation.
        Returns:
        the result of the Evaluation (for a get operation), or null (for a set operation).
      • setResult

        public void setResult​(java.lang.Object value)
        Sets the result of the Evaluation. This method is normally only used interally and should not be set without knowledge of what you are doing.
        Parameters:
        value - the result Object for this Evaluation.
      • getException

        public java.lang.Throwable getException()
        Returns the exception that occurred as a result of evaluating the Evaluation, or null if no exception occurred.
        Returns:
        an exception if one occurred during evaluation, or null (no exception) otherwise.
      • setException

        public void setException​(java.lang.Throwable value)
        Sets the exception that occurred as a result of evaluating the Evaluation. This method is normally only used interally and should not be set without knowledge of what you are doing.
        Parameters:
        value - the Throwable exception that occurred during the evaluation of this Evaluation.
      • getParent

        public Evaluation getParent()
        Returns the parent evaluation of this evaluation. If this returns null then it is is the root evaluation of a tree.
        Returns:
        the parent Evaluation of the current Evaluation, or null if no parent exists.
      • getNext

        public Evaluation getNext()
        Returns the next sibling of this evaluation. Returns null if this is the last in a chain of evaluations.
        Returns:
        the next sibling Evaluation of the current Evaluation, or null if this is the last Evaluation in a chain.
      • getPrevious

        public Evaluation getPrevious()
        Returns the previous sibling of this evaluation. Returns null if this is the first in a chain of evaluations.
        Returns:
        the previous sibling Evaluation of the current Evaluation, or null if this is the first Evaluation in a chain.
      • getFirstChild

        public Evaluation getFirstChild()
        Returns the first child of this evaluation. Returns null if there are no children.
        Returns:
        the first child Evaluation of the current Evaluation, or null if no children exist.
      • getLastChild

        public Evaluation getLastChild()
        Returns the last child of this evaluation. Returns null if there are no children.
        Returns:
        the last child Evaluation of the current Evaluation, or null if no children exist.
      • getFirstDescendant

        public Evaluation getFirstDescendant()
        Gets the first descendent. In any Evaluation tree this will the Evaluation that was first executed.
        Returns:
        the first descendant Evaluation (first Evaluation executed in the tree).
      • getLastDescendant

        public Evaluation getLastDescendant()
        Gets the last descendent. In any Evaluation tree this will the Evaluation that was most recently executing.
        Returns:
        the last descendant Evaluation (most recent Evaluation executed in the tree).
      • addChild

        public void addChild​(Evaluation child)
        Adds a child to the list of children of this evaluation. The parent of the child is set to the receiver and the children references are modified in the receiver to reflect the new child. The lastChild of the receiver is set to the child, and the firstChild is set also if child is the first (or only) child.
        Parameters:
        child - an Evaluation to add as a child to the current Evaluation.
      • init

        public void init​(SimpleNode node,
                         java.lang.Object source,
                         boolean setOperation)
        Reinitializes this Evaluation to the parameters specified.
        Parameters:
        node - a SimpleNode for this Evaluation.
        source - a source Object for this Evaluation.
        setOperation - true to identify this Evaluation as a set operation, false to identify it as a get operation.
      • reset

        public void reset()
        Resets this Evaluation to the initial state.
      • toString

        public java.lang.String toString​(boolean compact,
                                         boolean showChildren,
                                         java.lang.String depth)
        Produces a String value for the Evaluation. If compact is true then a more compact form of the description only including the node type and unique identifier is shown, else a full description including source and result are shown. If showChildren is true the child evaluations are printed using the depth string given as a prefix.
        Parameters:
        compact - true to generate a compact form of the description for this Evaluation, false for a full form.
        showChildren - true to generate descriptions for child Evaluation elements of this Evaluation.
        depth - prefix String to use in front of child Evaluation description output - used when showChildren is true.
        Returns:
        the description of this Evaluation as a String.
      • toString

        public java.lang.String toString​(boolean compact,
                                         java.lang.String depth)
        Produces a String value for the Evaluation. If compact is true then a more compact form of the description only including the node type and unique identifier is shown, else a full description including source and result are shown. Child evaluations are printed using the depth string given as a prefix.
        Parameters:
        compact - true to generate a compact form of the description for this Evaluation, false for a full form.
        depth - prefix String to use in front of child Evaluation description output - used when showChildren is true.
        Returns:
        the description of this Evaluation as a String.
      • toString

        public java.lang.String toString()
        Returns a String description of the Evaluation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the description of this Evaluation as a String.