当前位置:网站首页>封装统一返回对象MessageResult
封装统一返回对象MessageResult
2022-07-28 14:22:00 【大海中一粒沙子】
package com.wc.robotapi.common;
public class MessageResult<T> {
private boolean Result;
private String ErrorMessage;
private T KeyValue;
public static <T> MessageResult<T> success(T data){
return new MessageResult<T>(data);
}
public static <T> MessageResult<T> success(){
return new MessageResult<T>();
}
public static <T> MessageResult error(String _ErrorMessage){
return new MessageResult<T>(_ErrorMessage);
}
private MessageResult(T data){
this.Result = true;
this.ErrorMessage = "SUCCESS";
this.KeyValue = data;
}
private MessageResult(){
this.Result = true;
this.ErrorMessage = "SUCCESS";
}
private MessageResult(String _ErrorMessage){
// if (_Result) {
// return;
// }
this.Result = false;
this.ErrorMessage = _ErrorMessage;
}
public boolean getResult() {
return Result;
}
public void setResult(Boolean Result) {
this.Result = Result;
}
public String getMessage() {
return ErrorMessage;
}
public void setMessage(String ErrorMessage) {
this.ErrorMessage = ErrorMessage;
}
public T getKeyValue() {
return KeyValue;
}
public void setKeyValue(T KeyValue) {
this.KeyValue = KeyValue;
}
}
边栏推荐
- 4519. Number of square arrays
- JS -- realize the rotation chart (complete function)
- Touch hands to realize canal how to access Mysql to realize data write operation monitoring
- Feeling about software development work in the second anniversary
- 软件开发三大痛点!小程序容器如何解决?
- 【LeetCode】35、搜索插入位置
- Untitled may
- Ry-d1/1 voltage relay
- 3540. 二叉搜索树
- Iframe tag
猜你喜欢
随机推荐
chrome插件调试
3715. 最少交换次数
@DS('slave') 多数据源兼容事务问题解决方案
Three pain points of software development! How to solve the applet container?
4518. Minimum ticket price
边缘技术和小程序容器在智能家居中的应用
Jwy-32b voltage relay
Collation of MySQL error prone knowledge points (to be updated)
Application of edge technology and applet container in smart home
volatile原理
DataTables warning: table id=campaignTable - Cannot reinitialise DataTable.解决
How Charles installs and uses
CCSP国际注册云安全专家在中国设置考场
Feeling about software development work in the second anniversary
即刻体验 | 借助 CTS-D 进一步提升应用设备兼容性
一文看懂CRMEB开源在线教育知知识付费系统
Compose learning notes 1-compose, state, flow, remember
Voltage relay dy-28c
JY-7GA/1电压继电器
crmeb 标准版Window+phpstudy8安装教程(一)









