You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xian/ResultGenerator.java

43 lines
1.1 KiB

package com.power.travel.core;
/**
*
*/
public class ResultGenerator {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
public static Result genSuccessResult() {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE);
}
public static Result genSuccessResult(Object data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE)
.setData(data);
}
public static Result genSuccessMsgResult(String msg) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(msg);
}
public static Result genFailResult(String message) {
return new Result()
.setCode(ResultCode.FAIL)
.setMessage(message);
}
public static Result genResult(String message) {
return new Result()
.setCode(ResultCode.DATA_ERROR)
.setMessage(message);
}
}