您的位置:首页 > 产品设计 > UI/UE

接口 ValueStack:com.opensymphony.xwork2.util

2015-11-08 21:10 495 查看
相关阅读:

在 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

com.opensymphony.xwork2.util


接口 ValueStack

所有已知实现类:OgnlValueStack
public interface ValueStack

ValueStack 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.String
REPORT_ERRORS_ON_NO_PROP
 
static java.lang.String
VALUE_STACK
 

方法概要

方法 
限定符和类型方法和说明
java.lang.String
findString(java.lang.String expr)
 
java.lang.String
findString(java.lang.String expr,
boolean throwExceptionOnFailure)
 
java.lang.Object
findValue(java.lang.String expr)

Find a value by evaluating the given expression against the stack in the default search order.
java.lang.Object
findValue(java.lang.String expr,
boolean throwExceptionOnFailure)
 
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.
java.lang.Object
findValue(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.
CompoundRoot
getRoot()

Get the CompoundRoot which holds the objects pushed onto the stack
java.lang.Object
peek()

Get the object on the top of the stack without changing the stack.
java.lang.Object
pop()

Get the object on the top of the stack and remove it from the stack.
void
push(java.lang.Object o)

Put this object onto the top of the stack
void
set(java.lang.String key,
java.lang.Object o)

Sets an object on the stack with the given key so it is retrievable by 
findValue(String)
,
findValue(String,
Class)

void
setDefaultType(java.lang.Class defaultType)

Sets the default type to convert to if no type is provided when getting a value.
void
setExprOverrides(java.util.Map<java.lang.Object,java.lang.Object> overrides)

Set a override map containing 
key -> values
 that takes precedent when doing find operations on the ValueStack.
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.
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.
int
size()

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 containing 
key -> values
 that 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 by 
findValue(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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: