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

📄 request.java

📁 完成考试功能完成考试功能完成考试功能完成考试功能完成考试功能完成考试功能
💻 JAVA
字号:
package com.tarena.exam.model;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.tarena.exam.exceptions.IllegalResponseTypeException;

public class Request implements Serializable{
	public static final int LOGIN_REQUEST=1;
	public static final int BEGIN_REQUEST=2;
	public static final int SEND_REQUEST=3;
	public static final int QUIT_REQUEST=4;
	
	private int type;
	private Map<String,Serializable> data;
	private static final long serialVersionUID=-371890756421779L;
	
	public Request(int type){
		switch(type){
		case LOGIN_REQUEST:
		case BEGIN_REQUEST:
		case SEND_REQUEST:
		case QUIT_REQUEST:this.type=type;break;
			default: throw new IllegalResponseTypeException("无效的异常类型:"+type);
		}
		data=new HashMap<String,Serializable>();
	}
	
	public void addData(String key,Serializable value){
		data.put(key,value);
	}
	
	public Serializable getData(String key){
		return data.get(key);
	}

	public int getType() {
		return type;
	}

}

⌨️ 快捷键说明

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