mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 06:58:41 +00:00
feat: added notification pattern (#2629)
Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user