WebSocketRange增加几个小方法

This commit is contained in:
Redkale
2020-01-07 10:21:01 +08:00
parent 55ab279e7f
commit 4d3d73b4c1

View File

@@ -18,35 +18,47 @@ import org.redkale.convert.json.JsonConvert;
* @author zhangjx * @author zhangjx
*/ */
public class WebSocketRange implements Serializable { public class WebSocketRange implements Serializable {
protected String wskey; protected String wskey;
protected Map<String, String> attach; protected Map<String, String> attach;
public WebSocketRange() { public WebSocketRange() {
} }
public WebSocketRange(String wskey) { public WebSocketRange(String wskey) {
this.wskey = wskey; this.wskey = wskey;
} }
public WebSocketRange(String wskey, Map<String, String> attach) { public WebSocketRange(String wskey, Map<String, String> attach) {
this.wskey = wskey; this.wskey = wskey;
this.attach = attach; this.attach = attach;
} }
public boolean containsAttach(String key) {
return this.attach == null ? false : this.attach.containsKey(key);
}
public String getAttach(String key) {
return this.attach == null ? null : this.attach.get(key);
}
public String getAttach(String key, String defval) {
return this.attach == null ? defval : this.attach.getOrDefault(key, defval);
}
public String getWskey() { public String getWskey() {
return wskey; return wskey;
} }
public void setWskey(String wskey) { public void setWskey(String wskey) {
this.wskey = wskey; this.wskey = wskey;
} }
public Map<String, String> getAttach() { public Map<String, String> getAttach() {
return attach; return attach;
} }
public void setAttach(Map<String, String> attach) { public void setAttach(Map<String, String> attach) {
this.attach = attach; this.attach = attach;
} }