📄 response.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 + -