|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opensymphony.xwork2.ognl.OgnlValueStack
public class OgnlValueStack
Ognl implementation of a value stack that allows for dynamic Ognl expressions to be evaluated against it. When evaluating an expression, the stack will be searched down the stack, from the latest objects pushed in to the earliest, looking for a bean with a getter or setter for the given property or a method of the given name (depending on the expression being evaluated).
| Field Summary | |
|---|---|
static String |
THROW_EXCEPTION_ON_FAILURE
|
| Fields inherited from interface com.opensymphony.xwork2.util.ValueStack |
|---|
REPORT_ERRORS_ON_NO_PROP, VALUE_STACK |
| Constructor Summary | |
|---|---|
protected |
OgnlValueStack(ValueStack vs,
XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
boolean allowStaticAccess)
|
protected |
OgnlValueStack(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
TextProvider prov,
boolean allowStaticAccess)
|
| Method Summary | |
|---|---|
void |
clearContextValues()
Remove all values from the context |
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 |
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. |
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. |
void |
setLogMissingProperties(String logMissingProperties)
|
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. |
void |
setPropertiesJudge(PropertiesJudge judge)
|
protected void |
setRoot(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
CompoundRoot compoundRoot,
boolean allowStaticMethodAccess)
|
void |
setValue(String expr,
Object value)
/** |
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. |
int |
size()
Get the number of objects in the stack |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String THROW_EXCEPTION_ON_FAILURE
| Constructor Detail |
|---|
protected OgnlValueStack(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
TextProvider prov,
boolean allowStaticAccess)
protected OgnlValueStack(ValueStack vs,
XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
boolean allowStaticAccess)
| Method Detail |
|---|
public void setOgnlUtil(OgnlUtil ognlUtil)
protected void setRoot(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
CompoundRoot compoundRoot,
boolean allowStaticMethodAccess)
public void setDevMode(String mode)
public void setLogMissingProperties(String logMissingProperties)
public Map<String,Object> getContext()
ValueStack
getContext in interface ValueStackValueStack.getContext()public void setDefaultType(Class defaultType)
ValueStack
setDefaultType in interface ValueStackdefaultType - the new default typeValueStack.setDefaultType(java.lang.Class)public void setExprOverrides(Map<Object,Object> overrides)
ValueStackkey -> values that takes precedent when doing find operations on the ValueStack.
See the unit test for ValueStackTest for examples.
setExprOverrides in interface ValueStackoverrides - overrides map.ValueStack.setExprOverrides(java.util.Map)public Map<Object,Object> getExprOverrides()
ValueStack
getExprOverrides in interface ValueStackValueStack.getExprOverrides()public CompoundRoot getRoot()
ValueStack
getRoot in interface ValueStackValueStack.getRoot()
public void setParameter(String expr,
Object value)
ValueStack
setParameter in interface ValueStackexpr - 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)
setValue in interface ValueStackexpr - 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 ValueStackexpr - 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)public String findString(String expr)
findString in interface ValueStackValueStack.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 ValueStackValueStack.findValue(java.lang.String)public Object findValue(String expr)
ValueStack
findValue in interface ValueStackexpr - the expression giving the path of properties to navigate to find the property value to return
public Object findValue(String expr,
Class asType,
boolean throwExceptionOnFailure)
findValue in interface ValueStackValueStack.findValue(java.lang.String, java.lang.Class)
public Object findValue(String expr,
Class asType)
ValueStack
findValue in interface ValueStackexpr - the expression giving the path of properties to navigate to find the property value to returnasType - the type to convert the return value to
public Object peek()
ValueStack
peek in interface ValueStackValueStack.peek()public Object pop()
ValueStack
pop in interface ValueStackValueStack.pop()public void push(Object o)
ValueStack
push in interface ValueStacko - the object to be pushed onto the stackValueStack.push(java.lang.Object)
public void set(String key,
Object o)
ValueStackValueStack.findValue(String), ValueStack.findValue(String, Class)
set in interface ValueStackkey - the keyo - the objectValueStack.set(java.lang.String, java.lang.Object)public int size()
ValueStack
size in interface ValueStackValueStack.size()public void clearContextValues()
ClearableValueStack
clearContextValues in interface ClearableValueStackpublic void setAcceptProperties(Set<Pattern> acceptedProperties)
setAcceptProperties in interface MemberAccessValueStackpublic void setPropertiesJudge(PropertiesJudge judge)
setPropertiesJudge in interface MemberAccessValueStackpublic void setExcludeProperties(Set<Pattern> excludeProperties)
setExcludeProperties in interface MemberAccessValueStack
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||