public class OgnlValueStack extends Object implements Serializable, ValueStack, ClearableValueStack, MemberAccessValueStack
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
context |
protected Class |
defaultType |
protected OgnlUtil |
ognlUtil |
protected Map<Object,Object> |
overrides |
protected CompoundRoot |
root |
protected SecurityMemberAccess |
securityMemberAccess |
static String |
THROW_EXCEPTION_ON_FAILURE |
REPORT_ERRORS_ON_NO_PROP, VALUE_STACK
Modifier | Constructor and Description |
---|---|
protected |
OgnlValueStack(ValueStack vs,
XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
boolean allowStaticMethodAccess,
boolean allowStaticFieldAccess) |
protected |
OgnlValueStack(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
TextProvider prov,
boolean allowStaticMethodAccess,
boolean allowStaticFieldAccess) |
Modifier and Type | Method and Description |
---|---|
void |
clearContextValues()
Remove all values from the context
|
protected Object |
findInContext(String name) |
String |
findString(String expr) |
String |
findString(String expr,
boolean throwExceptionOnFailure) |
Object |
findValue(String expr)
Find a value by evaluating the given expression against the stack in the default search order.
|
Object |
findValue(String expr,
boolean throwExceptionOnFailure) |
Object |
findValue(String expr,
Class asType)
Find a value by evaluating the given expression against the stack in the default search order.
|
Object |
findValue(String expr,
Class asType,
boolean throwExceptionOnFailure) |
Map<String,Object> |
getContext()
Gets the context for this value stack.
|
Map<Object,Object> |
getExprOverrides()
Gets the override map if anyone exists.
|
CompoundRoot |
getRoot()
Get the CompoundRoot which holds the objects pushed onto the stack
|
protected Object |
handleOgnlException(String expr,
boolean throwExceptionOnFailure,
ognl.OgnlException e) |
protected void |
handleOgnlException(String expr,
Object value,
boolean throwExceptionOnFailure,
ognl.OgnlException e) |
protected Object |
handleOtherException(String expr,
boolean throwExceptionOnFailure,
Exception e) |
protected void |
handleRuntimeException(String expr,
Object value,
boolean throwExceptionOnFailure,
RuntimeException re) |
Object |
peek()
Get the object on the top of the stack without changing the stack.
|
Object |
pop()
Get the object on the top of the stack and remove it from the stack.
|
void |
push(Object o)
Put this object onto the top of the stack
|
void |
set(String key,
Object o)
Sets an object on the stack with the given key
so it is retrievable by
ValueStack.findValue(String) , ValueStack.findValue(String, Class) |
void |
setAcceptProperties(Set<Pattern> acceptedProperties) |
void |
setDefaultType(Class defaultType)
Sets the default type to convert to if no type is provided when getting a value.
|
protected void |
setDevMode(String mode) |
void |
setExcludeProperties(Set<Pattern> excludeProperties) |
void |
setExprOverrides(Map<Object,Object> overrides)
Set a override map containing
key -> values that takes precedent when doing find operations on the ValueStack. |
protected void |
setLogMissingProperties(String logMissingProperties) |
protected void |
setOgnlUtil(OgnlUtil ognlUtil) |
void |
setParameter(String expr,
Object value)
Attempts to set a property on a bean in the stack with the given expression using the default search order.
|
protected void |
setRoot(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
CompoundRoot compoundRoot,
boolean allowStaticMethodAccess,
boolean allowStaticFieldAccess) |
protected void |
setupExceptionOnFailure(boolean throwExceptionOnFailure) |
void |
setValue(String expr,
Object value)
Attempts to set a property on a bean in the stack with the given expression using the default search order.
|
void |
setValue(String expr,
Object value,
boolean throwExceptionOnFailure)
Attempts to set a property on a bean in the stack with the given expression using the default search order.
|
protected void |
setXWorkConverter(XWorkConverter converter) |
protected boolean |
shouldLogMissingPropertyWarning(ognl.OgnlException e) |
int |
size()
Get the number of objects in the stack
|
public static final String THROW_EXCEPTION_ON_FAILURE
protected CompoundRoot root
protected Class defaultType
protected transient OgnlUtil ognlUtil
protected transient SecurityMemberAccess securityMemberAccess
protected OgnlValueStack(XWorkConverter xworkConverter, CompoundRootAccessor accessor, TextProvider prov, boolean allowStaticMethodAccess, boolean allowStaticFieldAccess)
protected OgnlValueStack(ValueStack vs, XWorkConverter xworkConverter, CompoundRootAccessor accessor, boolean allowStaticMethodAccess, boolean allowStaticFieldAccess)
protected void setOgnlUtil(OgnlUtil ognlUtil)
protected void setRoot(XWorkConverter xworkConverter, CompoundRootAccessor accessor, CompoundRoot compoundRoot, boolean allowStaticMethodAccess, boolean allowStaticFieldAccess)
protected void setDevMode(String mode)
protected void setLogMissingProperties(String logMissingProperties)
public Map<String,Object> getContext()
ValueStack
getContext
in interface ValueStack
ValueStack.getContext()
public void setDefaultType(Class defaultType)
ValueStack
setDefaultType
in interface ValueStack
defaultType
- the new default typeValueStack.setDefaultType(java.lang.Class)
public void setExprOverrides(Map<Object,Object> overrides)
ValueStack
key -> values
that takes precedent when doing find operations on the ValueStack.
See the unit test for ValueStackTest for examples.
setExprOverrides
in interface ValueStack
overrides
- overrides map.ValueStack.setExprOverrides(java.util.Map)
public Map<Object,Object> getExprOverrides()
ValueStack
getExprOverrides
in interface ValueStack
ValueStack.getExprOverrides()
public CompoundRoot getRoot()
ValueStack
getRoot
in interface ValueStack
ValueStack.getRoot()
public void setParameter(String expr, Object value)
ValueStack
setParameter
in interface ValueStack
expr
- the expression defining the path to the property to be set.value
- the value to be set into the named propertyValueStack.setParameter(String, Object)
public void setValue(String expr, Object value)
ValueStack
setValue
in interface ValueStack
expr
- the expression defining the path to the property to be set.value
- the value to be set into the named propertyValueStack.setValue(java.lang.String, java.lang.Object)
public void setValue(String expr, Object value, boolean throwExceptionOnFailure)
ValueStack
setValue
in interface ValueStack
expr
- the expression defining the path to the property to be set.value
- the value to be set into the named propertythrowExceptionOnFailure
- a flag to tell whether an exception should be thrown if there is no property with
the given name.ValueStack.setValue(java.lang.String, java.lang.Object, boolean)
protected void handleRuntimeException(String expr, Object value, boolean throwExceptionOnFailure, RuntimeException re)
protected void handleOgnlException(String expr, Object value, boolean throwExceptionOnFailure, ognl.OgnlException e)
public String findString(String expr)
findString
in interface ValueStack
ValueStack.findString(java.lang.String)
public String findString(String expr, boolean throwExceptionOnFailure)
findString
in interface ValueStack
public Object findValue(String expr, boolean throwExceptionOnFailure)
findValue
in interface ValueStack
ValueStack.findValue(java.lang.String)
protected void setupExceptionOnFailure(boolean throwExceptionOnFailure)
protected Object handleOtherException(String expr, boolean throwExceptionOnFailure, Exception e)
public Object findValue(String expr)
ValueStack
findValue
in interface ValueStack
expr
- the expression giving the path of properties to navigate to find the property value to returnpublic Object findValue(String expr, Class asType, boolean throwExceptionOnFailure)
findValue
in interface ValueStack
ValueStack.findValue(java.lang.String, java.lang.Class)
protected Object handleOgnlException(String expr, boolean throwExceptionOnFailure, ognl.OgnlException e)
protected boolean shouldLogMissingPropertyWarning(ognl.OgnlException e)
public Object findValue(String expr, Class asType)
ValueStack
findValue
in interface ValueStack
expr
- the expression giving the path of properties to navigate to find the property value to returnasType
- the type to convert the return value topublic Object peek()
ValueStack
peek
in interface ValueStack
ValueStack.peek()
public Object pop()
ValueStack
pop
in interface ValueStack
ValueStack.pop()
public void push(Object o)
ValueStack
push
in interface ValueStack
o
- the object to be pushed onto the stackValueStack.push(java.lang.Object)
public void set(String key, Object o)
ValueStack
ValueStack.findValue(String)
, ValueStack.findValue(String, Class)
set
in interface ValueStack
key
- the keyo
- the objectValueStack.set(java.lang.String, java.lang.Object)
public int size()
ValueStack
size
in interface ValueStack
ValueStack.size()
public void clearContextValues()
ClearableValueStack
clearContextValues
in interface ClearableValueStack
public void setAcceptProperties(Set<Pattern> acceptedProperties)
setAcceptProperties
in interface MemberAccessValueStack
public void setExcludeProperties(Set<Pattern> excludeProperties)
setExcludeProperties
in interface MemberAccessValueStack
protected void setXWorkConverter(XWorkConverter converter)
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.