ValueStack 源码
/*
* Copyright 2002-2007,2009 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.opensymphony.xwork2.util; import java.util.Map; /**
* 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).
*/
public interface ValueStack { public static final String VALUE_STACK = "com.opensymphony.xwork2.util.ValueStack.ValueStack"; public static final String REPORT_ERRORS_ON_NO_PROP = "com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp"; /**
* Gets the context for this value stack. The context holds all the information in the value stack and it's surroundings.
*
* @return the context.
*/
public abstract Map<String, Object> getContext(); /**
* Sets the default type to convert to if no type is provided when getting a value.
*
* @param defaultType the new default type
*/
public abstract void setDefaultType(Class defaultType); /**
* Set a override map containing <code>key -> values</code> that takes precedent when doing find operations on the ValueStack.
* <p/>
* See the unit test for ValueStackTest for examples.
*
* @param overrides overrides map.
*/
public abstract void setExprOverrides(Map<Object, Object> overrides); /**
* Gets the override map if anyone exists.
*
* @return the override map, <tt>null</tt> if not set.
*/
public abstract Map<Object, Object> getExprOverrides(); /**
* Get the CompoundRoot which holds the objects pushed onto the stack
*
* @return the root
*/
public abstract CompoundRoot getRoot(); /**
* Attempts to set a property on a bean in the stack with the given expression using the default search order.
*
* @param expr the expression defining the path to the property to be set.
* @param value the value to be set into the named property
*/
public abstract 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.
* N.B.: unlike #setValue(String,Object) it doesn't allow eval expression.
* @param expr the expression defining the path to the property to be set.
* @param value the value to be set into the named property
*/
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.
*
* @param expr the expression defining the path to the property to be set.
* @param value the value to be set into the named property
* @param throwExceptionOnFailure a flag to tell whether an exception should be thrown if there is no property with
* the given name.
*/
public abstract void setValue(String expr, Object value, boolean throwExceptionOnFailure); public abstract String findString(String expr);
public abstract String findString(String expr, boolean throwExceptionOnFailure); /**
* Find a value by evaluating the given expression against the stack in the default search order.
*
* @param expr the expression giving the path of properties to navigate to find the property value to return
* @return the result of evaluating the expression
*/
public abstract Object findValue(String expr); public abstract Object findValue(String expr, boolean throwExceptionOnFailure); /**
* Find a value by evaluating the given expression against the stack in the default search order.
*
* @param expr the expression giving the path of properties to navigate to find the property value to return
* @param asType the type to convert the return value to
* @return the result of evaluating the expression
*/
public abstract Object findValue(String expr, Class asType);
public abstract Object findValue(String expr, Class asType, boolean throwExceptionOnFailure); /**
* Get the object on the top of the stack <b>without</b> changing the stack.
*
* @return the object on the top.
* @see CompoundRoot#peek()
*/
public abstract Object peek(); /**
* Get the object on the top of the stack and <b>remove</b> it from the stack.
*
* @return the object on the top of the stack
* @see CompoundRoot#pop()
*/
public abstract Object pop(); /**
* Put this object onto the top of the stack
*
* @param o the object to be pushed onto the stack
* @see CompoundRoot#push(Object)
*/
public abstract void push(Object o); /**
* Sets an object on the stack with the given key
* so it is retrievable by {@link #findValue(String)}, {@link #findValue(String, Class)}
*
* @param key the key
* @param o the object
*/
public abstract void set(String key, Object o); /**
* Get the number of objects in the stack
*
* @return the number of objects in the stack
*/
public abstract int size(); }
ValueStack 源码的更多相关文章
- Struts2 源码分析——Action代理类的工作
章节简言 上一章笔者讲到关于如何加载配置文件里面的package元素节点信息.相信读者到这里心里面对struts2在启动的时候加载相关的信息有了一定的了解和认识.而本章将讲到关于struts2启动成功 ...
- Struts2 源码分析——调结者(Dispatcher)之执行action
章节简言 上一章笔者写关于Dispatcher类如何处理接受来的request请求.当然读者们也知道他并非正真的执行action操作.他只是在执行action操作之前的准备工作.那么谁才是正真的执行a ...
- SpringMVC源码剖析(四)- DispatcherServlet请求转发的实现
SpringMVC完成初始化流程之后,就进入Servlet标准生命周期的第二个阶段,即“service”阶段.在“service”阶段中,每一次Http请求到来,容器都会启动一个请求线程,通过serv ...
- struts请求源码的跟踪
最近工作任务不是很紧,时间也不能白白浪费,以前常用的struts2框架源码没去了解过,所以就跟踪一下struts2的整个执行过程.由于本人也是抱着学习的态度来阅读掩码,若文章在表述和代码方面如有不妥之 ...
- struts2拦截器源码分析
前面博客我们介绍了开发struts2应用程序的基本流程(开发一个struts2的实例),通过前面我们知道了struts2实现请求转发和配置文件加载都是拦截器进行的操作,这也就是为什么我们要在web.x ...
- OA学习笔记-010-Struts部分源码分析、Intercepter、ModelDriver、OGNL、EL
一.分析 二. 1.OGNL 在访问action前,要经过各种intercepter,其中ParameterFilterInterceptor会把各咱参数放到ValueStack里,从而使OGNL可以 ...
- Struts2运行流程-源码剖析
本文为原创,如需转载,请标明出处:http://www.cnblogs.com/gudu1/p/7726172.html 首先说一下查看这些框架源码的感受,每一次深入探究 Spring.Struts ...
- Struts2 源码剖析 控制部分-----1
这部分着重分析从我们发出一个uri请求,一直到代码运行到我们自己写的action类为止,struts的控制部分的代码(还有数据流部分,我们后面再分析) 已经用了快1年多的struts2了,一直认为对开 ...
- Struts2源码解析2
看了前面一节对Struts2各个模块运行有了大概了解,也对调用的函数有了一定的了解,本节希望打断点跑一个Struts2例子! 还是放在struts2结构图: 一:项目启动后解析web.xml文件,会解 ...
随机推荐
- 报 "错误: 无法取消引用int" 的问题解决纪录
很久没上博客园了,估计有一年左右了,最近在写一个android的小工具应用,今天写多国语言时,引用 string.xml里面的值,R.string.XXX时,突然报 『错误: 无法取消引用int』,我 ...
- 【洛谷1337】[JSOI2004] 吊打XXX(模拟退火经典题)
点此看题面 大致题意: 一个平面上有\(n\)个点,每个点有1个权值,现在要选择平面上的一个点,使这\(n\)个点的权值乘上到达选定点的距离之和最小. 模拟退火 我们可以用模拟退火来做这道题. 先将\ ...
- WPF实现ListView大小图标和分组
XAML: <ListView Grid.Row="3" Name="t_lvw_time" HorizontalAlignment="Stre ...
- c++question 005 c++中转义字符有哪些?
(1)'\a' 注意,这里不再是两个字符\ 和 a 而是表达了一个具体的含义是,蜂鸣一声 (2)'\n' 换行,这里不再是两个字符\ 和 n 而是表达了一个具体的含义是,相当于 endl (3)'\ ...
- SummerVocation_Learning--StringBuffer类
java.lang.StringBuffer代表可变的字符序列.与String类基本类似. 常见的构造方法: StringBuffer(),创建一个不包含字符序列的空的StringBuffer对象. ...
- linux系统快捷键使用
本文记录linux系统中快捷键的使用 Ctrl + l 清屏,相当于clear命令Ctrl + o 执行当前命令,并重新显示本命令Ctrl + s 阻止屏幕输出,锁定Ctrl + q 允许屏幕输出Ct ...
- 【Python学习之十】yield之send方法
yield作用 简单地讲,yield 的作用就是把一个函数变成一个 generator,带有 yield 的函数不再是一个普通函数,Python 解释器会将其视为一个 generator.下面以斐波拉 ...
- IE console报错
需要注意的是,使用console对象查看对象信息,在IE8浏览器下未打开开发人员工具(F12)的情况下 会报'console'未定义错误. 解决办法:1.打开开发人员调试工具(F12) ...
- LeetCode955删列造序 ||
问题:删列造序 || 给定由 N 个小写字母字符串组成的数组 A,其中每个字符串长度相等. 选取一个删除索引序列,对于 A 中的每个字符串,删除对应每个索引处的字符. 比如,有 A = [" ...
- thinkphp 5数据库操作
1.原生sql $options=Db::table('__MALL_POST__') ->alias('m') ->join('__MALL_CATEGORY_VALUE__ v','m ...