response.java
来自「这是一个很好的考试系统的源码」· Java 代码 · 共 51 行
JAVA
51 行
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 implements Serializable{ /** * */ private static final long serialVersionUID=1L; 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() { super(); } 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 + =
减小字号Ctrl + -
显示快捷键?