Class Notifier
java.lang.Object
page.codeberg.friedolyn.notifications.Notifier
- All Implemented Interfaces:
Redactable
- Direct Known Subclasses:
EMailNotifier
,NtfyNotifier
,UnifiedPushNotifier
Abstract class that uses some kind of notification channel to inform the user of something, e.g. a new grade.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
What the user will likely perceive the content of the message as. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
sendNotification
(@NonNull String subject, @NonNull String summary, @NonNull String message) Sends a notification with the given subject, summary and message to the user.(package private) abstract void
sendNotification
(@NonNull String subject, @NonNull String summary, @NonNull String message, @NonNull Notifier.Mood mood) Sends a notification with the given subject, summary and message to the user.abstract @NonNull String
toString()
abstract @NonNull String
-
Constructor Details
-
Notifier
public Notifier()
-
-
Method Details
-
toString
- Specified by:
toString
in interfaceRedactable
- Overrides:
toString
in classObject
- Returns:
- A string representation of this object including all fields, even sensitive ones.
-
toStringRedacted
- Specified by:
toStringRedacted
in interfaceRedactable
- Returns:
- A string representation of this object including all fields. However, sensitive fields will be removed or replaced with a placeholder. The exact behaviour is implementation-specific and may depend on the debug level currently in effect.
-
sendNotification
public void sendNotification(@NonNull @NonNull String subject, @NonNull @NonNull String summary, @NonNull @NonNull String message) throws RuntimeException Sends a notification with the given subject, summary and message to the user.- Parameters:
subject
- What the notification is about.summary
- A short version of the message. Should be a one-liner that summarises the full message.message
- The full message that should be sent to the user. Depending on the implementation, full messages might be too long to be displayed (in full) and might therefore be truncated or omitted entirely.- Throws:
RuntimeException
- If the notification could not be sent or if the subject, summary or message is blank.- See Also:
-
sendNotification
abstract void sendNotification(@NonNull @NonNull String subject, @NonNull @NonNull String summary, @NonNull @NonNull String message, @NonNull @NonNull Notifier.Mood mood) throws RuntimeException Sends a notification with the given subject, summary and message to the user.- Parameters:
subject
- What the notification is about.summary
- A short version of the message. Should be a one-liner that summarises the full message.message
- The full message that should be sent to the user. Depending on the implementation, full messages might be too long to be displayed (in full) and might therefore be truncated or omitted entirely.mood
- Whether the content of the message contains news that the user will likely perceive as positive, or negative (or neither – in which case the mood is neutral).- Throws:
RuntimeException
- If the notification could not be sent or if the subject, summary or message is blank.- See Also:
-