java response 返回_java response通用返回

java response通用返回

编程语言

• Java

• 611次浏览

• 0次点赞

• 2019-04-25 12:42

场景

后台 接口统一返回 code、message、data

responseEntity

import com.maox.common.enums.ResponseEnums;

import lombok.Data;

/**

* ResponseEntity

*

* @author maoxian

* @since 2019-04-24 14:09

*/

@Data

public class ResponseEntity {

private String code;

private String msg;

private Object data;

private ResponseEntity(Object data) {

this.code = ResponseEnums.SUCCESS_OPTION.getCode();

this.msg = ResponseEnums.SUCCESS_OPTION.getMsg();

this.data = data;

}

private ResponseEntity(ResponseEnums responseEnums) {

this.code = responseEnums.getCode();

this.msg = responseEnums.getMsg();

}

你可能感兴趣的:(java,response,返回)