Skip to content

Instantly share code, notes, and snippets.

View douglas444's full-sized avatar
🤒
Out sick

Douglas M douglas444

🤒
Out sick
View GitHub Profile
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");
}
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) {