可以尝试使用参数少的方法调用参数多的方法。(不是百分之百适用,需要尝试)
例如:
public static JsonResult fail(ServiceException e){
//JsonResult jsonresult = new JsonResult();
//jsonResult.setState(e.getServiceCode().getValue());
//jsonResult.setMessage(e.getMessage());
//return jsonResult;
return fail(e.getServiceCode(), e.getMessage());
}
public static JsonResult fail(ServiceCode serviceCode, String message){
JsonResult jsonresult = new JsonResult();
jsonResult.setState(serviceCode.getValue());
jsonResult.setMessage(message);
return jsonResult;
}