NIMSDK-AOS  10.9.80
V2NIMChatroomTagTempChatBannedParams.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.chatroom.params;
2 
3 import android.text.TextUtils;
4 import java.io.Serializable;
5 
6 /**
7  * 聊天室标签临时禁言参数
8  */
9 public class V2NIMChatroomTagTempChatBannedParams implements Serializable {
10 
11  /**
12  * 禁言的tag
13  */
14  private String targetTag;
15  /**
16  * 消息的目标标签表达式, 标签表达式
17  */
18  private String notifyTargetTags;
19  /**
20  * 禁言时长
21  */
22  private Integer duration;
23  /**
24  * 是否需要通知
25  * 默认为true
26  */
27  private Boolean notificationEnabled;
28  /**
29  * 本次操作生成的通知中的扩展字段
30  */
31  private String notificationExtension;
32 
34  }
35 
36  /**
37  * 获取禁言的tag
38  * @return 禁言的tag
39  */
40  public String getTargetTag() {
41  return targetTag;
42  }
43 
44  /**
45  * 获取消息的目标标签表达式, 标签表达式
46  * @return 消息的目标标签表达式, 标签表达式
47  */
48  public String getNotifyTargetTags() {
49  return notifyTargetTags;
50  }
51 
52  /**
53  * 获取禁言时长
54  * @return 禁言时长
55  */
56  public int getDuration() {
57  if (duration == null) {
58  return 0;
59  }
60  return duration;
61  }
62 
63  /**
64  * 是否需要通知
65  * @return 是否需要通知
66  */
67  public boolean isNotificationEnabled() {
68  if (notificationEnabled == null) {
69  return true;
70  }
71  return notificationEnabled;
72  }
73 
74  /**
75  * 获取本次操作生成的通知中的扩展字段
76  * @return 本次操作生成的通知中的扩展字段
77  */
78  public String getNotificationExtension() {
79  return notificationExtension;
80  }
81 
82  /**
83  * 设置禁言的tag
84  * @param targetTag 禁言的tag
85  */
86  public void setTargetTag(String targetTag) {
87  this.targetTag = targetTag;
88  }
89 
90  /**
91  * 设置消息的目标标签表达式, 标签表达式
92  * @param notifyTargetTags 消息的目标标签表达式, 标签表达式
93  */
94  public void setNotifyTargetTags(String notifyTargetTags) {
95  this.notifyTargetTags = notifyTargetTags;
96  }
97 
98  /**
99  * 设置禁言时长
100  * @param duration 禁言时长
101  */
102  public void setDuration(int duration) {
103  this.duration = duration;
104  }
105 
106  /**
107  * 设置是否需要通知
108  * @param notificationEnabled 是否需要通知
109  */
110  public void setNotificationEnabled(boolean notificationEnabled) {
111  this.notificationEnabled = notificationEnabled;
112  }
113 
114  /**
115  * 设置本次操作生成的通知中的扩展字段
116  * @param notificationExtension 本次操作生成的通知中的扩展字段
117  */
118  public void setNotificationExtension(String notificationExtension) {
119  this.notificationExtension = notificationExtension;
120  }
121 
122  public boolean isValid() {
123  if (TextUtils.isEmpty(targetTag)) {
124  return false;
125  }
126  if (duration != null && duration < 0) {
127  return false;
128  }
129  return true;
130  }
131 }
void setNotifyTargetTags(String notifyTargetTags)
设置消息的目标标签表达式, 标签表达式
void setNotificationExtension(String notificationExtension)
设置本次操作生成的通知中的扩展字段
String getNotifyTargetTags()
获取消息的目标标签表达式, 标签表达式