接口 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

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).
    • 方法概要

      方法  
      限定符和类型 方法和说明
      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











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值