⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 result.java

📁 oa办公系统
💻 JAVA
字号:
/**
 * FileName:Result.java,v 1.0 created in 2008-11-6 上午09:22:33
 * Created by sean
 * Copyright (c) 2008 wanczy
 * All Rights Reserved.
 */
package cn.jx.ecjtu.oa.services;

import java.util.HashMap;
import java.util.Map;

/**
 * 保存各个Service类处理的结果。
 * ret用于保存处理成功、失败、异常,取值见枚举类cn.jx.ecjtu.oa.services.ResultType
 * message用于保存反馈信息
 * attribute用于保存其他返回参数。
 * @author sean
 * @version $Revision: 1.3 $
 * @since 1.0
 */
public class Result {
	private ResultType ret;
	private String message;
	private Map<String, Object> attribute;
	/**
	 * 提供一个无参构造方法
	 *
	 */
	public Result() {
		// TODO Auto-generated constructor stub
	}
	/**
	 * 构造方法,一次性输入结果和消息。
	 * @param ret
	 * @param message
	 */
	public Result(ResultType ret,String message) {
		this.ret=ret;
		this.message=message;
	}
	/**
	 * 取得结果中的属性
	 * @param key
	 * @return
	 */
	public Object getAttribute(String key) {
		if(attribute==null) attribute=new HashMap<String, Object>();
		return attribute.get(key);
	}
	/**
	 * 设置结果中的属性
	 * @param key
	 * @param value
	 */
	public void setAttribute(String key, Object value) {
		if(attribute==null) attribute=new HashMap<String, Object>();
		this.attribute.put(key, value);
	}
	/**
	 * 取得所有的属性。
	 * for(Map.Entry entry: result.listAttribute()){
	 * 	   request.setAttribute(entry.getKey(),entry.getValue());
	 * }
	 * @return
	 */
	public Map<String, Object> listAttribute(){
		return attribute;
	}
	/**
	 * 取得反馈消息
	 * @return
	 */
	public String getMessage() {
		return message;
	}
	/**
	 * 设置反馈消息
	 * @param message
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	/**
	 * 取得结果类型
	 * @return
	 */
	public ResultType getRet() {
		return ret;
	}
	/**
	 * 设置结果类型。
	 * @param ret
	 */
	public void setRet(ResultType ret) {
		this.ret = ret;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -