Skip to content

Commit

Permalink
update some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lovepoem committed Apr 25, 2020
1 parent f09c564 commit d637217
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ target/
# system ignore
.DS_Store
Thumbs.db
*.orig`
*.orig
/release.properties
/*.releaseBackup
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>io.wangxin</groupId>
<artifactId>smart-result</artifactId>
<packaging>jar</packaging>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<name>smart-result</name>
<description>Result entity wrapper class, including return value status, object, error information, etc
</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/wangxin/result/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* Data wrapper class returned by Api
*
* @param <T>
* @param <T> return data
* @author Xin Wang
*/
public class Result<T> implements Serializable, Cloneable {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/io/wangxin/result/utils/ResultUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class ResultUtils {
/***
* wrap success result
* @param data return data
* @param <T>
* @return
* @param <T> return data
* @return status and data
*/
public static <T> Result<T> wrapSuccess(T data) {
Result<T> result = new Result<T>();
Expand All @@ -36,9 +36,8 @@ public static <T> Result<T> wrapSuccess(T data) {

/***
* wrap failure result ,return data is null
* @param
* @param <T> return data
* @return
* @return status and data
*/
public static <T> Result wrapSuccess() {
return wrapSuccess(null);
Expand All @@ -48,7 +47,7 @@ public static <T> Result wrapSuccess() {
* wrap failure result
* @param code error code
* @param message error message
* @return
* @return status and data
*/
public static Result wrapFailure(int code, String message) {
Result result = new Result(code, message);
Expand All @@ -57,18 +56,18 @@ public static Result wrapFailure(int code, String message) {

/***
* wrap failure result
* @param failCodeDesc
* @return
* @param failCodeDesc error code
* @return status and data
*/
public static Result wrapFailure(IFailCode failCodeDesc) {
return wrapFailure(failCodeDesc.getValue(), failCodeDesc.getDesc());
}

/***
* wrap failure result, Use when the error message has variables
* @param failCode
* @param failCode error code
* @param msgValues dynamic parameters of error message
* @return
* @return status and data
*/
public static Result wrapFailure(IFailCode failCode, String... msgValues) {
String msg = failCode.getDesc();
Expand All @@ -81,6 +80,7 @@ public static Result wrapFailure(IFailCode failCode, String... msgValues) {
/**
* @return Print error and return failure, system level
* @see Result ,Unified printing exception
* @param e Exception
*/
public static Result wrapException(Exception e) {
logger.error("Interface throws an exception:", e);
Expand Down

0 comments on commit d637217

Please sign in to comment.