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 Assert { | |
| private Assert() { | |
| } | |
| public static void required(Object... objects) { | |
| for (int i = 0, objectsLength = objects.length; i < objectsLength; i++) { | |
| if (objects[i] == null || (objects[i] instanceof String && ((String) objects[i]).isBlank())) { | |
| throw new DomainException("Parameter " + i + " is required"); | |
| } |
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
| import java.util.function.Function; | |
| import java.util.function.Supplier; | |
| public class Result<T> { | |
| private final boolean success; | |
| private final String errorMessage; | |
| private final T data; | |
| private Result(boolean success, String errorMessage, T data) { |