Created
January 6, 2022 15:49
-
-
Save Kwonkyu/ab6f9b949e5250f17e476ac408a0b990 to your computer and use it in GitHub Desktop.
Revisions
-
Kwonkyu created this gist
Jan 6, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import lombok.AllArgsConstructor; import lombok.Getter; @Getter @AllArgsConstructor public class ApiResponse <T> { private final boolean success; private final T result; private final String message; public static <U> ApiResponse<U> success(U result) { return new ApiResponse<>(true, result, ""); } public static <U> ApiResponse<U> success(U result, String message) { return new ApiResponse<>(true, result, message); } public static <U> ApiResponse<U> fail(String message) { return new ApiResponse<>(false, null, message); } public static <U> ApiResponse<U> fail(U result, String message) { return new ApiResponse<>(false, result, message); } }