Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
1ee3b43d
Commit
1ee3b43d
authored
May 14, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加对Android的支持
parent
c5d0c2fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
ResponseResult.java
...src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
+33
-2
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/vo/ResponseResult.java
View file @
1ee3b43d
package
com
.
yanzuoguang
.
util
.
vo
;
import
com.yanzuoguang.util.contants.ResultConstants
;
import
com.yanzuoguang.util.helper.StringHelper
;
/**
* 接口之间的通讯结果
*
* @author 颜佐光
*/
public
class
ResponseResult
<
T
>
extends
BaseVo
{
...
...
@@ -153,10 +155,39 @@ public class ResponseResult<T> extends BaseVo {
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
result
(
T
data
)
{
return
result
(
data
,
false
);
}
/**
* 构造成功结果,不允许为空
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
resultAllowNull
(
T
data
)
{
return
result
(
data
,
true
);
}
/**
* 构造成功结果
*
* @param data 数据
* @param allowNull 允许为空
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public
static
final
<
T
extends
Object
>
ResponseResult
<
T
>
result
(
T
data
,
boolean
allowNull
)
{
ResponseResult
<
T
>
ret
=
new
ResponseResult
<
T
>();
ret
.
setCode
(
ResultConstants
.
SUCCESS
);
ret
.
setMessage
(
"处理成功"
);
ret
.
setData
(
data
);
if
(!
allowNull
&&
StringHelper
.
isEmpty
(
data
))
{
ret
.
setCode
(
ResultConstants
.
RESULT_EMPTY
);
ret
.
setMessage
(
"结果为空"
);
}
else
{
ret
.
setCode
(
ResultConstants
.
SUCCESS
);
ret
.
setMessage
(
"处理成功"
);
}
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment