NIMSDK-AOS  10.9.80
V2NIMChatroomQueueOfferParams.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.chatroom.params;
2 
3 import android.text.TextUtils;
4 
5 /**
6  * 聊天室队列新增或者更新队列元素参数
7  */
9  /**
10  * 元素的唯一key
11  * 长度限制: 128字节
12  * 如果队列key不存在,则追加到队尾,否则更新相应元素
13  */
14  private final String elementKey;
15 
16  /**
17  * 元素的值
18  * 长度限制: 4096字节
19  */
20  private final String elementValue;
21 
22  /**
23  * 元素是否瞬态的
24  * true: 当前元素所属的成员退出或者掉线时,同步删除
25  * false: 元素保留
26  */
27  private boolean isTransient = false;
28 
29  /**
30  * 元素属于的账号,默认为当前操作者
31  * 管理员操作,可以指定元素属于的合法账号
32  */
33  private String elementOwnerAccountId;
34 
35  /**
36  * 构造函数
37  * @param elementKey 元素的唯一key
38  * @param elementValue 元素的值
39  */
40  public V2NIMChatroomQueueOfferParams(String elementKey, String elementValue) {
41  this.elementKey = elementKey;
42  this.elementValue = elementValue;
43  }
44 
46  this.elementKey = null;
47  this.elementValue = null;
48  }
49 
50  /**
51  * 获取元素的唯一key
52  * @return 元素的唯一key
53  */
54  public String getElementKey() {
55  return elementKey;
56  }
57 
58  /**
59  * 获取元素的值
60  * @return 元素的值
61  */
62  public String getElementValue() {
63  return elementValue;
64  }
65 
66 
67  /**
68  * 判断元素是否为瞬态的
69  * @return true表示元素是瞬态的,false表示元素是持久的
70  */
71  public boolean isTransient() {
72  return isTransient;
73  }
74 
75  /**
76  * 设置元素是否为瞬态的
77  * @param isTransient true表示元素是瞬态的,当前元素所属的成员退出或者掉线时会同步删除;
78  * false表示元素是持久的,会被保留
79  */
80  public void setTransient(boolean isTransient) {
81  this.isTransient = isTransient;
82  }
83 
84  /**
85  * 获取元素属于的账号
86  * @return 元素属于的账号,如果未设置则返回null
87  */
88  public String getElementOwnerAccountId() {
89  return elementOwnerAccountId;
90  }
91 
92  /**
93  * 设置元素属于的账号
94  * @param elementOwnerAccountId 元素属于的账号,默认为当前操作者。
95  * 管理员操作时,可以指定元素属于的合法账号
96  */
97  public void setElementOwnerAccountId(String elementOwnerAccountId) {
98  this.elementOwnerAccountId = elementOwnerAccountId;
99  }
100 
101  /**
102  * 判断参数是否有效
103  * @return
104  */
105  public boolean isValid(){
106  if(TextUtils.isEmpty(elementKey)){
107  return false;
108  }
109 
110  if(TextUtils.isEmpty(elementValue)){
111  return false;
112  }
113 
114  return true;
115  }
116 }
void setTransient(boolean isTransient)
设置元素是否为瞬态的
V2NIMChatroomQueueOfferParams(String elementKey, String elementValue)
构造函数
void setElementOwnerAccountId(String elementOwnerAccountId)
设置元素属于的账号