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

📄 response.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 Response {
	public static final int LOGIN_RESPONSE=1;
	public static final int BEGIN_RESPONSE=2;
	public static final int SEND_RESPONSE=3;
	public static final int QUIT_RESPONSE=4;
	
	private int type;
	private Map<String,Serializable> data;
	
	
	public Response(int type){
		switch(type){
		case LOGIN_RESPONSE:
		case BEGIN_RESPONSE:
		case SEND_RESPONSE:
		case QUIT_RESPONSE:this.type=type;break;
			default: throw new IllegalResponseTypeException("无效的异常类型:"+type);
		}
		data=new HashMap<String,Serializable>();
	}
	
	public void addData(String para,Serializable value){
		data.put(para, value);
	}
	
	public Serializable getData(String para){
		return data.get(para);
	}
	
	public int getType(){
		return type;
	}

}

⌨️ 快捷键说明

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