...
Code Block |
---|
@Component public class ResponseInfoFactory { public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; final String ver = requestInfo != null ? requestInfo.getVer() : ""; Long ts = null; if(requestInfo!=null) ts = requestInfo.getTs(); final String resMsgId = "uief87324"; final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; final String responseStatus = success ? "successful" : "failed"; return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) .status(responseStatus).build(); } } |
API recommendations:- Preferably, any services you develop should implement APIs for all 4 CRUD operations.