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 Stringstatic final Stringstatic final ClassResolverstatic final MemberAccessstatic final TypeConverterstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic 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 TypeMethodDescriptionvoidaddLocalReference(String key, LocalReference reference) voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanGets 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.booleanReturns 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.booleaninthashCode()intbooleanisEmpty()keySet()Pops the current Evaluation off of the top of the stack.voidpushEvaluation(Evaluation value) Pushes a new Evaluation onto the stack.voidvoidThis 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.voidsetClassResolver(ClassResolver value) voidsetCurrentAccessor(Class type) voidsetCurrentEvaluation(Evaluation value) voidsetCurrentNode(Node value) voidsetCurrentObject(Object value) voidsetCurrentType(Class type) voidsetKeepLastEvaluation(boolean value) Sets whether the last evaluation that was done on this context is retained and available throughgetLastEvaluation().voidsetLastEvaluation(Evaluation value) voidsetMemberAccess(MemberAccess value) voidsetPreviousType(Class type) voidvoidsetRootEvaluation(Evaluation value) voidsetTraceEvaluations(boolean value) voidsetTypeConverter(TypeConverter value) voidintsize()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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:
containsKeyin interfaceMap
-
containsValue
- Specified by:
containsValuein interfaceMap
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode()
-