Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ObjectNotFoundException extends RuntimeException {
- private static final long serialVersionUID = 1L;
- private final List<String> messages = List.of();
- @Getter
- private final String message;
- public ObjectNotFoundException(List<String> messages) {
- super();
- this.message = messages.stream().collect(Collectors.joining("\n"));
- }
- public ObjectNotFoundException(String message) {
- super();
- this.message = message;
- }
- public ObjectNotFoundException() {
- super();
- messages = Collections.emptyList();
- }
- public static void notNull(Object o, String message) {
- if (o == null) {
- throw new ObjectNotFoundException(List.of(message));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement