Package ognl

Class OgnlContext

java.lang.Object
ognl.OgnlContext
All Implemented Interfaces:
Map

public class OgnlContext extends Object implements Map
This class defines the execution context for an OGNL expression
Author:
Luke Blanshard (blanshlu@netscape.net), Drew Davidson (drew@ognl.org)
  • Field Details

  • Constructor Details

    • OgnlContext

      public OgnlContext()
      Constructs a new OgnlContext with the default class resolver, type converter and member access.
    • OgnlContext

      public OgnlContext(ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess)
      Constructs a new OgnlContext with the given class resolver, type converter and member access. If any of these parameters is null the default will be used.
    • OgnlContext

      public OgnlContext(Map values)
    • OgnlContext

      public OgnlContext(ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess, Map values)
  • Method Details

    • setValues

      public void setValues(Map value)
    • getValues

      public Map getValues()
    • setClassResolver

      public void setClassResolver(ClassResolver value)
    • getClassResolver

      public ClassResolver getClassResolver()
    • setTypeConverter

      public void setTypeConverter(TypeConverter value)
    • getTypeConverter

      public TypeConverter getTypeConverter()
    • setMemberAccess

      public void setMemberAccess(MemberAccess value)
    • getMemberAccess

      public MemberAccess getMemberAccess()
    • setRoot

      public void setRoot(Object value)
    • getRoot

      public Object getRoot()
    • getTraceEvaluations

      public boolean getTraceEvaluations()
    • setTraceEvaluations

      public void setTraceEvaluations(boolean value)
    • getLastEvaluation

      public Evaluation getLastEvaluation()
    • setLastEvaluation

      public void setLastEvaluation(Evaluation value)
    • recycleLastEvaluation

      public void recycleLastEvaluation()
      This method can be called when the last evaluation has been used and can be returned for reuse in the free pool maintained by the runtime. This is not a necessary step, but is useful for keeping memory usage down. This will recycle the last evaluation and then set the last evaluation to null.
    • getKeepLastEvaluation

      public boolean getKeepLastEvaluation()
      Returns true if the last evaluation that was done on this context is retained and available through getLastEvaluation(). The default is true.
    • setKeepLastEvaluation

      public void setKeepLastEvaluation(boolean value)
      Sets whether the last evaluation that was done on this context is retained and available through getLastEvaluation(). The default is true.
    • setCurrentObject

      public void setCurrentObject(Object value)
    • getCurrentObject

      public Object getCurrentObject()
    • setCurrentAccessor

      public void setCurrentAccessor(Class type)
    • getCurrentAccessor

      public Class getCurrentAccessor()
    • getPreviousAccessor

      public Class getPreviousAccessor()
    • getFirstAccessor

      public Class getFirstAccessor()
    • getCurrentType

      public Class getCurrentType()
      Gets the current class type being evaluated on the stack, as set by setCurrentType(Class).
      Returns:
      The current object type, may be null.
    • setCurrentType

      public void setCurrentType(Class type)
    • getPreviousType

      public Class getPreviousType()
      Represents the last known object type on the evaluation stack, will be the value of the last known getCurrentType().
      Returns:
      The previous type of object on the stack, may be null.
    • setPreviousType

      public void setPreviousType(Class type)
    • getFirstType

      public Class getFirstType()
    • setCurrentNode

      public void setCurrentNode(Node value)
    • getCurrentNode

      public Node getCurrentNode()
    • getCurrentEvaluation

      public Evaluation getCurrentEvaluation()
      Gets the current Evaluation from the top of the stack. This is the Evaluation that is in process of evaluating.
    • setCurrentEvaluation

      public void setCurrentEvaluation(Evaluation value)
    • getRootEvaluation

      public Evaluation getRootEvaluation()
      Gets the root of the evaluation stack. This Evaluation contains the node representing the root expression and the source is the root source object.
    • setRootEvaluation

      public void setRootEvaluation(Evaluation value)
    • getEvaluation

      public Evaluation getEvaluation(int relativeIndex)
      Returns the Evaluation at the relative index given. This should be zero or a negative number as a relative reference back up the evaluation stack. Therefore getEvaluation(0) returns the current Evaluation.
    • pushEvaluation

      public void pushEvaluation(Evaluation value)
      Pushes a new Evaluation onto the stack. This is done before a node evaluates. When evaluation is complete it should be popped from the stack via popEvaluation().
    • popEvaluation

      public Evaluation popEvaluation()
      Pops the current Evaluation off of the top of the stack. This is done after a node has completed its evaluation.
    • incrementLocalReferenceCounter

      public int incrementLocalReferenceCounter()
    • addLocalReference

      public void addLocalReference(String key, LocalReference reference)
    • getLocalReferences

      public Map getLocalReferences()
    • size

      public int size()
      Specified by:
      size in interface Map
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map
    • get

      public Object get(Object key)
      Specified by:
      get in interface Map
    • put

      public Object put(Object key, Object value)
      Specified by:
      put in interface Map
    • remove

      public Object remove(Object key)
      Specified by:
      remove in interface Map
    • putAll

      public void putAll(Map t)
      Specified by:
      putAll in interface Map
    • clear

      public void clear()
      Specified by:
      clear in interface Map
    • keySet

      public Set keySet()
      Specified by:
      keySet in interface Map
    • values

      public Collection values()
      Specified by:
      values in interface Map
    • entrySet

      public Set entrySet()
      Specified by:
      entrySet in interface Map
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map
      Overrides:
      hashCode in class Object