From 4d3d73b4c196ab1be069a1a41bb23675226e91cf Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Tue, 7 Jan 2020 10:21:01 +0800 Subject: [PATCH] =?UTF-8?q?WebSocketRange=E5=A2=9E=E5=8A=A0=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E5=B0=8F=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/net/http/WebSocketRange.java | 30 ++++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/org/redkale/net/http/WebSocketRange.java b/src/org/redkale/net/http/WebSocketRange.java index a8f5ca550..70ab73147 100644 --- a/src/org/redkale/net/http/WebSocketRange.java +++ b/src/org/redkale/net/http/WebSocketRange.java @@ -18,35 +18,47 @@ import org.redkale.convert.json.JsonConvert; * @author zhangjx */ public class WebSocketRange implements Serializable { - + protected String wskey; - + protected Map attach; - + public WebSocketRange() { } - + public WebSocketRange(String wskey) { this.wskey = wskey; } - + public WebSocketRange(String wskey, Map attach) { this.wskey = wskey; 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() { return wskey; } - + public void setWskey(String wskey) { this.wskey = wskey; } - + public Map getAttach() { return attach; } - + public void setAttach(Map attach) { this.attach = attach; }