Package ognl
Class OgnlContext
java.lang.Object
ognl.OgnlContext
- All Implemented Interfaces:
Map
This class defines the execution context for an OGNL expression
- Author:
- Luke Blanshard (blanshlu@netscape.net), Drew Davidson (drew@ognl.org)
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final ClassResolver
static final MemberAccess
static final TypeConverter
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new OgnlContext with the default class resolver, type converter and member access.OgnlContext
(Map values) OgnlContext
(ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess) Constructs a new OgnlContext with the given class resolver, type converter and member access.OgnlContext
(ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess, Map values) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocalReference
(String key, LocalReference reference) void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
Gets the current Evaluation from the top of the stack.Gets the current class type being evaluated on the stack, as set bysetCurrentType(Class)
.getEvaluation
(int relativeIndex) Returns the Evaluation at the relative index given.boolean
Returns true if the last evaluation that was done on this context is retained and available throughgetLastEvaluation()
.Represents the last known object type on the evaluation stack, will be the value of the last knowngetCurrentType()
.getRoot()
Gets the root of the evaluation stack.boolean
int
hashCode()
int
boolean
isEmpty()
keySet()
Pops the current Evaluation off of the top of the stack.void
pushEvaluation
(Evaluation value) Pushes a new Evaluation onto the stack.void
void
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.void
setClassResolver
(ClassResolver value) void
setCurrentAccessor
(Class type) void
setCurrentEvaluation
(Evaluation value) void
setCurrentNode
(Node value) void
setCurrentObject
(Object value) void
setCurrentType
(Class type) void
setKeepLastEvaluation
(boolean value) Sets whether the last evaluation that was done on this context is retained and available throughgetLastEvaluation()
.void
setLastEvaluation
(Evaluation value) void
setMemberAccess
(MemberAccess value) void
setPreviousType
(Class type) void
void
setRootEvaluation
(Evaluation value) void
setTraceEvaluations
(boolean value) void
setTypeConverter
(TypeConverter value) void
int
size()
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
CONTEXT_CONTEXT_KEY
- See Also:
-
ROOT_CONTEXT_KEY
- See Also:
-
THIS_CONTEXT_KEY
- See Also:
-
TRACE_EVALUATIONS_CONTEXT_KEY
- See Also:
-
LAST_EVALUATION_CONTEXT_KEY
- See Also:
-
KEEP_LAST_EVALUATION_CONTEXT_KEY
- See Also:
-
CLASS_RESOLVER_CONTEXT_KEY
- See Also:
-
TYPE_CONVERTER_CONTEXT_KEY
- See Also:
-
MEMBER_ACCESS_CONTEXT_KEY
- See Also:
-
DEFAULT_CLASS_RESOLVER
-
DEFAULT_TYPE_CONVERTER
-
DEFAULT_MEMBER_ACCESS
-
-
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
-
OgnlContext
public OgnlContext(ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess, Map values)
-
-
Method Details
-
setValues
-
getValues
-
setClassResolver
-
getClassResolver
-
setTypeConverter
-
getTypeConverter
-
setMemberAccess
-
getMemberAccess
-
setRoot
-
getRoot
-
getTraceEvaluations
public boolean getTraceEvaluations() -
setTraceEvaluations
public void setTraceEvaluations(boolean value) -
getLastEvaluation
-
setLastEvaluation
-
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 throughgetLastEvaluation()
. 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 throughgetLastEvaluation()
. The default is true. -
setCurrentObject
-
getCurrentObject
-
setCurrentAccessor
-
getCurrentAccessor
-
getPreviousAccessor
-
getFirstAccessor
-
getCurrentType
Gets the current class type being evaluated on the stack, as set bysetCurrentType(Class)
.- Returns:
- The current object type, may be null.
-
setCurrentType
-
getPreviousType
Represents the last known object type on the evaluation stack, will be the value of the last knowngetCurrentType()
.- Returns:
- The previous type of object on the stack, may be null.
-
setPreviousType
-
getFirstType
-
setCurrentNode
-
getCurrentNode
-
getCurrentEvaluation
Gets the current Evaluation from the top of the stack. This is the Evaluation that is in process of evaluating. -
setCurrentEvaluation
-
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
-
getEvaluation
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
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 viapopEvaluation()
. -
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
-
getLocalReferences
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap
-
containsValue
- Specified by:
containsValue
in interfaceMap
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode()
-