NIMSDK-AOS  10.9.80
V2NIMLocalConversationFilter.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.conversation.params;
2 
4 import com.netease.nimlib.util.CollectionUtil;
5 import java.util.HashSet;
6 import java.util.List;
7 import java.util.Objects;
8 import java.util.Set;
9 
10 /**
11  * 本地会话过滤器
12  */
14 
15  /**
16  * 会话类型列表,为空表示查询所有类型,否则查询指定对话类型
17  */
18  private List<V2NIMConversationType> conversationTypes = null;
19  /**
20  * 是否忽略免打扰
21  */
22  private boolean ignoreMuted = false;
23  /**
24  * 内部去重处理Set
25  */
26  private Set<V2NIMConversationType> conversationTypeSet = null;
27 
29  }
30 
31  /**
32  * @param types 会话类型列表,为空表示查询所有类型,否则查询指定对话类型
33  */
34  public V2NIMLocalConversationFilter(List<V2NIMConversationType> types) {
35  this.conversationTypes = types;
36  if(types != null)
37  {
38  this.conversationTypeSet = new HashSet<>(types);
39  }
40  }
41 
42  /**
43  * @param types 会话类型列表,为空表示查询所有类型,否则查询指定对话类型
44  * @param ignoreMuted 是否忽略免打扰
45  */
46  public V2NIMLocalConversationFilter(List<V2NIMConversationType> types, boolean ignoreMuted) {
47  this(types);
48  this.ignoreMuted = ignoreMuted;
49  }
50 
51 
52  /**
53  * 获取会话类型列表,为空表示查询所有类型,否则查询指定对话类型
54  * @return 会话类型列表,为空表示查询所有类型,否则查询指定对话类型
55  */
56  public List<V2NIMConversationType> getConversationTypes() {
57  return conversationTypes;
58  }
59 
60  /**
61  * 获取会话类型集合
62  * @return
63  */
64  public Set<V2NIMConversationType> getConversationTypeSet() {
65  if(CollectionUtil.isNotEmpty(conversationTypes) && CollectionUtil.isEmpty(conversationTypeSet))
66  {
67  conversationTypeSet = new HashSet<>(conversationTypes);
68  }
69  return conversationTypeSet;
70  }
71 
72  /**
73  * 设置会话类型列表
74  * @param conversationTypes 会话类型列表,为空表示查询所有类型,否则查询指定对话类型
75  */
76  public void setConversationTypes(List<V2NIMConversationType> conversationTypes) {
77  this.conversationTypes = conversationTypes;
78  }
79 
80  /**
81  * 获取是否忽略免打扰
82  * @return 是否忽略免打扰
83  */
84  public boolean isIgnoreMuted() {
85  return ignoreMuted;
86  }
87 
88  /**
89  * 设置是否忽略免打扰
90  * @param ignoreMuted 是否忽略免打扰
91  */
92  public void setIgnoreMuted(boolean ignoreMuted) {
93  this.ignoreMuted = ignoreMuted;
94  }
95 
96  @Override
97  public boolean equals(Object o) {
98  if (this == o) {
99  return true;
100  }
101  if (!(o instanceof V2NIMLocalConversationFilter)) {
102  return false;
103  }
104  V2NIMLocalConversationFilter that = (V2NIMLocalConversationFilter) o;
105  return ignoreMuted == that.ignoreMuted && Objects.equals(getConversationTypeSet(),
106  that.getConversationTypeSet());
107  }
108 
109  @Override
110  public int hashCode() {
111  return Objects.hash(ignoreMuted, getConversationTypeSet());
112  }
113 
114  @Override
115  public String toString() {
116  return "V2NIMConversationFilter{" + "conversationTypes=" + conversationTypes + ", ignoreMuted=" + ignoreMuted + '}';
117  }
118 }
V2NIMLocalConversationFilter(List< V2NIMConversationType > types, boolean ignoreMuted)
List< V2NIMConversationType > getConversationTypes()
获取会话类型列表,为空表示查询所有类型,否则查询指定对话类型
Set< V2NIMConversationType > getConversationTypeSet()
获取会话类型集合
void setConversationTypes(List< V2NIMConversationType > conversationTypes)
设置会话类型列表