NIMSDK-AOS  10.6.0
Event.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.event.model;
2 
3 import java.io.Serializable;
4 import java.util.Map;
5 
6 public class Event implements Serializable {
7 
8  protected Event() {
9 
10  }
11 
12  public Event(int eventType, int eventValue, long expiry) {
13  this.eventType = eventType;
14  this.eventValue = eventValue;
15  this.expiry = expiry;
16  }
17 
21  protected String eventId;
22 
26  protected int eventType;
27 
31  protected int eventValue;
32 
36  protected String config;
37 
41  protected long expiry;
42 
46  protected boolean broadcastOnlineOnly;
47 
51  protected boolean syncSelfEnable;
52 
56  protected String publisherAccount;
57 
61  protected long publishTime;
62 
66  protected int publisherClientType;
67 
71  protected String multiClientConfig;
72 
76  protected Map<Integer, String> multiClientConfigMap;
77 
81  protected String nimConfig;
82 
83  public void setEventType(int eventType) {
84  this.eventType = eventType;
85  }
86 
87  public void setEventValue(int eventValue) {
88  this.eventValue = eventValue;
89  }
90 
91  public void setConfig(String config) {
92  this.config = config;
93  }
94 
95  public void setBroadcastOnlineOnly(boolean broadcastOnlineOnly) {
96  this.broadcastOnlineOnly = broadcastOnlineOnly;
97  }
98 
99  public void setExpiry(long expiry) {
100  this.expiry = expiry;
101  }
102 
103  public void setSyncSelfEnable(boolean syncSelfEnable) {
104  this.syncSelfEnable = syncSelfEnable;
105  }
106 
107  public String getEventId() {
108  return eventId;
109  }
110 
111  public int getEventType() {
112  return eventType;
113  }
114 
115  public int getEventValue() {
116  return eventValue;
117  }
118 
119  public String getConfig() {
120  return config;
121  }
122 
123  public long getExpiry() {
124  return expiry;
125  }
126 
127  public boolean isBroadcastOnlineOnly() {
128  return broadcastOnlineOnly;
129  }
130 
131  public boolean isSyncSelfEnable() {
132  return syncSelfEnable;
133  }
134 
135  public String getPublisherAccount() {
136  return publisherAccount;
137  }
138 
139  public long getPublishTime() {
140  return publishTime;
141  }
142 
143  public int getPublisherClientType() {
144  return publisherClientType;
145  }
146 
147  public String getMultiClientConfig() {
148  return multiClientConfig;
149  }
150 
151  public String getConfigByClient(int clientType) {
152  // 解析
153  return multiClientConfigMap == null ? null : multiClientConfigMap.get(clientType);
154  }
155 
156  public String getNimConfig() {
157  return nimConfig;
158  }
159 }
Event(int eventType, int eventValue, long expiry)
Definition: Event.java:12
long expiry
事件的有效期,范围为 60s 到 7days,数值单位为秒
Definition: Event.java:41
void setSyncSelfEnable(boolean syncSelfEnable)
Definition: Event.java:103
String getConfigByClient(int clientType)
Definition: Event.java:151
String publisherAccount
事件发布者的云信账号
Definition: Event.java:56
void setBroadcastOnlineOnly(boolean broadcastOnlineOnly)
Definition: Event.java:95
int eventType
事件类型,1-99999 为云信保留类型
Definition: Event.java:26
void setEventType(int eventType)
Definition: Event.java:83
String nimConfig
预定义事件中服务端配置项,仅仅对预留事件有效
Definition: Event.java:81
boolean syncSelfEnable
是否支持多端同步
Definition: Event.java:51
int publisherClientType
事件发布者客户端类型
Definition: Event.java:66
void setEventValue(int eventValue)
Definition: Event.java:87
int eventValue
事件的状态值
Definition: Event.java:31
long publishTime
事件发布的时间
Definition: Event.java:61
String config
事件的扩展字段,最大长度为 256 字节,由事件发布客户端配置
Definition: Event.java:36
String multiClientConfig
多端 config 配置
Definition: Event.java:71
boolean broadcastOnlineOnly
是否只广播给在线用户,若为 false,事件支持在线广播和登录后同步
Definition: Event.java:46
Map< Integer, String > multiClientConfigMap
解析 multiClientConfig 的多端 config 配置 map
Definition: Event.java:76