ResultUtil.java 716 Bytes
package vion.utils;

import vion.enums.ResultEnum;
import vion.vo.ResultVO;

public class ResultUtil {

    public static ResultVO<Object> success(Object o) {
        ResultVO<Object> resultVO = new ResultVO<Object>();
        resultVO.setCode(ResultEnum.SUCCESS.getCode());
        resultVO.setMessage(ResultEnum.SUCCESS.getMessage());
        resultVO.setData(o);
        return resultVO;
    }

    public static ResultVO<Object> error(ResultEnum e) {
        ResultVO<Object> resultVO = new ResultVO<Object>();
        resultVO.setCode(e.getCode());
        resultVO.setMessage(e.getMessage());
        return resultVO;
    }

    public static ResultVO<Object> success() {
        return success(null);
    }
}