Created
March 4, 2018 13:54
-
-
Save josephmtinangi/2b58ae298d77711adf911bc41b4f4634 to your computer and use it in GitHub Desktop.
Java Create Response Helper Utility Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Helper { | |
public static ResponseEntity<?> createResponse(boolean success, Object data, String message, HttpStatus code) { | |
HashMap<String, Object> response = new HashMap<>(); | |
response.put("success", success); | |
response.put("data", data); | |
response.put("message", message); | |
response.put("code", code); | |
return new ResponseEntity<>(response, code); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment