本文主要是介绍接口 ValueStack:com.opensymphony.xwork2.util,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
相关阅读:
在 Struts 2 中自定义支持 OGNL 的标签:http://blog.csdn.net/ieayoio/article/details/49721587
API:http://www.boyunjian.com/javadoc/com.opensymphony/xwork-core/2.1.6/_/com/opensymphony/xwork2/util/ValueStack.html
接口 ValueStack
-
- 所有已知实现类:
- OgnlValueStack
public interface ValueStackValueStack allows multiple beans to be pushed in and dynamic EL 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).
-
-
字段概要
限定符和类型 字段和说明 static java.lang.StringREPORT_ERRORS_ON_NO_PROPstatic java.lang.StringVALUE_STACK
-
方法概要
限定符和类型 方法和说明 java.lang.StringfindString(java.lang.String expr)java.lang.StringfindString(java.lang.String expr, boolean throwExceptionOnFailure)java.lang.ObjectfindValue(java.lang.String expr)Find a value by evaluating the given expression against the stack in the default search order.java.lang.ObjectfindValue(java.lang.String expr, boolean throwExceptionOnFailure)java.lang.ObjectfindValue(java.lang.String expr, java.lang.Class asType)Find a value by evaluating the given expression against the stack in the default search order.java.lang.ObjectfindValue(java.lang.String expr, java.lang.Class asType, boolean throwExceptionOnFailure)java.util.Map<java.lang.String,java.lang.Object>getContext()Gets the context for this value stack.java.util.Map<java.lang.Object,java.lang.Object>getExprOverrides()Gets the override map if anyone exists.CompoundRootgetRoot()Get the CompoundRoot which holds the objects pushed onto the stackjava.lang.Objectpeek()Get the object on the top of the stack without changing the stack.java.lang.Objectpop()Get the object on the top of the stack and remove it from the stack.voidpush(java.lang.Object o)Put this object onto the top of the stackvoidset(java.lang.String key, java.lang.Object o)Sets an object on the stack with the given key so it is retrievable byfindValue(String),findValue(String, Class)voidsetDefaultType(java.lang.Class defaultType)Sets the default type to convert to if no type is provided when getting a value.voidsetExprOverrides(java.util.Map<java.lang.Object,java.lang.Object> overrides)Set a override map containingkey -> valuesthat takes precedent when doing find operations on the ValueStack.voidsetValue(java.lang.String expr, java.lang.Object value)Attempts to set a property on a bean in the stack with the given expression using the default search order.voidsetValue(java.lang.String expr, java.lang.Object value, boolean throwExceptionOnFailure)Attempts to set a property on a bean in the stack with the given expression using the default search order.intsize()Get the number of objects in the stack
-
-
-
字段详细资料
-
VALUE_STACK
static final java.lang.String VALUE_STACK
- 另请参阅:
- 常量字段值
-
REPORT_ERRORS_ON_NO_PROP
static final java.lang.String REPORT_ERRORS_ON_NO_PROP
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getContext
java.util.Map<java.lang.String,java.lang.Object> getContext()
Gets the context for this value stack. The context holds all the information in the value stack and it's surroundings.- 返回:
- the context.
-
setDefaultType
void setDefaultType(java.lang.Class defaultType)
Sets the default type to convert to if no type is provided when getting a value.- 参数:
-
defaultType- the new default type
-
-
setExprOverrides
void setExprOverrides(java.util.Map<java.lang.Object,java.lang.Object> overrides)
Set a override map containingkey -> valuesthat takes precedent when doing find operations on the ValueStack. See the unit test for ValueStackTest for examples.- 参数:
-
overrides- overrides map.
-
-
getExprOverrides
java.util.Map<java.lang.Object,java.lang.Object> getExprOverrides()
Gets the override map if anyone exists.- 返回:
- the override map, null if not set.
-
getRoot
CompoundRoot getRoot()
Get the CompoundRoot which holds the objects pushed onto the stack- 返回:
- the root
-
setValue
void setValue(java.lang.String expr,java.lang.Object value)
Attempts to set a property on a bean in the stack with the given expression using the default search order.- 参数:
-
expr- the expression defining the path to the property to be set. -
value- the value to be set into the named property
-
-
setValue
void setValue(java.lang.String expr,java.lang.Object value,boolean throwExceptionOnFailure)
Attempts to set a property on a bean in the stack with the given expression using the default search order.- 参数:
-
expr- the expression defining the path to the property to be set. -
value- the value to be set into the named property -
throwExceptionOnFailure- a flag to tell whether an exception should be thrown if there is no property with the given name.
-
-
findString
java.lang.String findString(java.lang.String expr)
-
findString
java.lang.String findString(java.lang.String expr,boolean throwExceptionOnFailure)
-
findValue
java.lang.Object findValue(java.lang.String expr)
Find a value by evaluating the given expression against the stack in the default search order.- 参数:
-
expr- the expression giving the path of properties to navigate to find the property value to return 返回: - the result of evaluating the expression
-
-
findValue
java.lang.Object findValue(java.lang.String expr,boolean throwExceptionOnFailure)
-
findValue
java.lang.Object findValue(java.lang.String expr,java.lang.Class asType)
Find a value by evaluating the given expression against the stack in the default search order.- 参数:
-
expr- the expression giving the path of properties to navigate to find the property value to return -
asType- the type to convert the return value to 返回: - the result of evaluating the expression
-
-
findValue
java.lang.Object findValue(java.lang.String expr,java.lang.Class asType,boolean throwExceptionOnFailure)
-
peek
java.lang.Object peek()
Get the object on the top of the stack without changing the stack.- 返回:
- the object on the top. 另请参阅:
-
CompoundRoot.peek()
-
pop
java.lang.Object pop()
Get the object on the top of the stack and remove it from the stack.- 返回:
- the object on the top of the stack 另请参阅:
-
CompoundRoot.pop()
-
push
void push(java.lang.Object o)
Put this object onto the top of the stack- 参数:
-
o- the object to be pushed onto the stack 另请参阅: -
CompoundRoot.push(Object)
-
-
set
void set(java.lang.String key,java.lang.Object o)
Sets an object on the stack with the given key so it is retrievable byfindValue(String),findValue(String, Class)- 参数:
-
key- the key -
o- the object
-
-
size
int size()
Get the number of objects in the stack- 返回:
- the number of objects in the stack
-
-
这篇关于接口 ValueStack:com.opensymphony.xwork2.util的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!