feat: added notification pattern (#2629)

Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
sugavanesh
2024-03-09 18:16:46 +05:30
committed by GitHub
parent b2ca49a4e5
commit 249efd1e71
17 changed files with 849 additions and 0 deletions
@@ -0,0 +1,26 @@
package com.iluwatar;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* The notification. Used for storing errors and any other methods
* that may be necessary for when we send information back to the
* presentation layer.
*/
@Getter
@NoArgsConstructor
public class Notification {
private final List<NotificationError> errors = new ArrayList<>();
public boolean hasErrors() {
return !this.errors.isEmpty();
}
public void addError(NotificationError error) {
this.errors.add(error);
}
}