NIMSDK-AOS  9.21.10
NIMMessageAIStreamStopParams.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg.params;
2 
3 import android.text.TextUtils;
5 import java.io.Serializable;
6 
7 /**
8  * NIMMessageAIStreamStopParams类
9  * <p>
10  * 该类用于配置停止数字人流式输出的参数。
11  * </p>
12  *
13  * @author jintao
14  * @version 1.0
15  */
16 public class NIMMessageAIStreamStopParams implements Serializable {
17 
18  /**
19  * 停止流式消息的操作类型
20  * 必填参数
21  */
22  private NIMMessageAIStreamStopOpType operationType;
23 
24  /**
25  * 更新的消息内容
26  * 非必填参数
27  * 仅当operationType设置为NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE时有效
28  */
29  private String updateContent;
30 
31  /**
32  * 默认构造函数
33  */
35  }
36 
37  /**
38  * 带操作类型的构造函数
39  *
40  * @param operationType 停止流式消息的操作类型
41  */
43  this.operationType = operationType;
44  }
45 
46  /**
47  * 完整参数的构造函数
48  *
49  * @param operationType 停止流式消息的操作类型
50  * @param updateContent 更新的消息内容
51  */
52  public NIMMessageAIStreamStopParams(NIMMessageAIStreamStopOpType operationType, String updateContent) {
53  this.operationType = operationType;
54  this.updateContent = updateContent;
55  }
56 
57  /**
58  * 获取停止流式消息的操作类型
59  *
60  * @return 操作类型
61  */
63  return operationType;
64  }
65 
66  /**
67  * 设置停止流式消息的操作类型
68  *
69  * @param operationType 操作类型
70  */
71  public void setOperationType(NIMMessageAIStreamStopOpType operationType) {
72  this.operationType = operationType;
73  }
74 
75  /**
76  * 获取更新的消息内容
77  *
78  * @return 更新的消息内容
79  */
80  public String getUpdateContent() {
81  return updateContent;
82  }
83 
84  /**
85  * 设置更新的消息内容
86  * 注意:此内容仅当operationType为NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE时有效
87  *
88  * @param updateContent 更新的消息内容
89  */
90  public void setUpdateContent(String updateContent) {
91  this.updateContent = updateContent;
92  }
93 
94  @Override
95  public String toString() {
96  return "NIMMessageAIStreamStopParams{" +
97  "operationType=" + operationType +
98  ", updateContent=" + updateContent +
99  '}';
100  }
101 
102  public boolean isValid() {
103  if (operationType == null){
104  return false;
105  }
106  if(operationType == NIMMessageAIStreamStopOpType.NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE && TextUtils.isEmpty(updateContent)){
107  return false;
108  }
109  return true;
110  }
111 
112  /**
113  * 构建器类,用于更方便地创建NIMMessageAIStreamStopParams对象
114  */
115  public static class Builder {
116  private final NIMMessageAIStreamStopOpType operationType;
117  private String updateContent;
118 
119  /**
120  * 构造函数,必须指定操作类型
121  *
122  * @param operationType 停止流式消息的操作类型
123  */
124  public Builder(NIMMessageAIStreamStopOpType operationType) {
125  this.operationType = operationType;
126  }
127 
128  /**
129  * 设置更新的消息内容
130  *
131  * @param updateContent 更新的消息内容
132  * @return 构建器实例
133  */
134  public Builder updateContent(String updateContent) {
135  this.updateContent = updateContent;
136  return this;
137  }
138 
139  /**
140  * 构建NIMMessageAIStreamStopParams对象
141  *
142  * @return 构建好的NIMMessageAIStreamStopParams对象
143  */
144  public NIMMessageAIStreamStopParams build() {
145  return new NIMMessageAIStreamStopParams(operationType, updateContent);
146  }
147  }
148 }
NIMMessageAIStreamStopOpType getOperationType()
获取停止流式消息的操作类型
void setUpdateContent(String updateContent)
设置更新的消息内容 注意:此内容仅当operationType为NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE时有效 ...
NIMMessageAIStreamStopParams(NIMMessageAIStreamStopOpType operationType, String updateContent)
完整参数的构造函数
void setOperationType(NIMMessageAIStreamStopOpType operationType)
设置停止流式消息的操作类型
NIMMessageAIStreamStopParams(NIMMessageAIStreamStopOpType operationType)
带操作类型的构造函数