日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java 数据返回类_java返回数据工具类

發布時間:2023/12/1 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java 数据返回类_java返回数据工具类 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1 importcom.qbskj.project.util.SpringUtils;2

3 /**

4 * 消息5 *6 */

7 public classMessage {8

9 /**

10 * 類型11 */

12 public enumType {13

14 /**成功*/

15 success,16

17 /**警告*/

18 warn,19

20 /**錯誤*/

21 error22 }23

24 /**類型*/

25 privateType type;26

27 /**內容*/

28 privateString content;29

30 /**數據*/

31 privateObject data;32

33 /**

34 * 初始化一個新創建的 Message 對象,使其表示一個空消息。35 */

36 publicMessage() {37

38 }39

40 /**

41 * 初始化一個新創建的 Message 對象42 *43 *@paramtype44 * 類型45 *@paramcontent46 * 內容47 */

48 publicMessage(Type type, String content) {49 this.type =type;50 this.content =content;51 }52

53 /**

54 *@paramtype55 * 類型56 *@paramcontent57 * 內容58 *@paramargs59 * 參數60 */

61 publicMessage(Type type, String content, Object... args) {62 this.type =type;63 this.content =SpringUtils.getMessage(content, args);64 }65

66 /**

67 *@paramtype68 * 類型69 *@paramdata70 * 數據71 *@paramcontent72 * 內容73 *@paramargs74 * 參數75 */

76 publicMessage(Type type, Object data, String content, Object... args) {77 this.type =type;78 this.data =data;79 this.content =SpringUtils.getMessage(content, args);80 }81

82 /**

83 * 返回成功消息84 *85 *@paramcontent86 * 內容87 *@paramargs88 * 參數89 *@return成功消息90 */

91 public staticMessage success(String content, Object... args) {92 return newMessage(Type.success, content, args);93 }94

95 /**

96 * 返回成功消息97 *98 *@paramcontent99 * 內容100 *@paramargs101 * 參數102 *@return成功消息103 */

104 public staticMessage successData(Object data, String content, Object... args) {105 return newMessage(Type.success, data, content, args);106 }107

108 /**

109 * 返回警告消息110 *111 *@paramcontent112 * 內容113 *@paramargs114 * 參數115 *@return警告消息116 */

117 public staticMessage warn(String content, Object... args) {118 return newMessage(Type.warn, content, args);119 }120

121 /**

122 * 返回錯誤消息123 *124 *@paramcontent125 * 內容126 *@paramargs127 * 參數128 *@return錯誤消息129 */

130 public staticMessage error(String content, Object... args) {131 return newMessage(Type.error, content, args);132 }133

134 /**

135 * 獲取類型136 *137 *@return類型138 */

139 publicType getType() {140 returntype;141 }142

143 /**

144 * 設置類型145 *146 *@paramtype147 * 類型148 */

149 public voidsetType(Type type) {150 this.type =type;151 }152

153 /**

154 * 獲取內容155 *156 *@return內容157 */

158 publicString getContent() {159 returncontent;160 }161

162 /**

163 * 設置內容164 *165 *@paramcontent166 * 內容167 */

168 public voidsetContent(String content) {169 this.content =content;170 }171

172 /**

173 *@returnthe data174 */

175 publicObject getData() {176 returndata;177 }178

179 /**

180 *@paramdata181 * the data to set182 */

183 public voidsetData(Object data) {184 this.data =data;185 }186

187 @Override188 publicString toString() {189 return "Message [type=" + type + ", content=" + SpringUtils.getMessage(content) + "]";190 }191

192 }

總結

以上是生活随笔為你收集整理的java 数据返回类_java返回数据工具类的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。