Package com.iizix.push
Class PushNotificationEvent
- java.lang.Object
- com.iizix.push.PushNotificationEvent
public class PushNotificationEvent extends java.lang.ObjectPush notification event generated when a push notification state changes, e.g. a notification has been sent successfully, or when the operation failed, the client unknown or the push service is stopped.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description java.lang.ThrowableexceptionThe exception thrown in case ofPushNotificationState.ERROR,nullotherwise.PushNotificationStatestateThe notification event state.
Constructor Summary
Constructors Constructor Description PushNotificationEvent(PushNotificationState state)Creates a notification event without exception, e.g.PushNotificationEvent(java.lang.Throwable exception)Creates a notification event with exception, i.e.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.ThrowablegetException()Gets the exception in case an error occurred, i.e.PushNotificationStategetState()Gets the notification event type.inthashCode()java.lang.StringtoString()
Field Detail
state
public final PushNotificationState state
The notification event state.
exception
public final java.lang.Throwable exception
The exception thrown in case ofPushNotificationState.ERROR,nullotherwise.
Constructor Detail
PushNotificationEvent
public PushNotificationEvent(PushNotificationState state)
Creates a notification event without exception, e.g. for the typesPushNotificationState.SUCCESSorPushNotificationState.SERVICE_STOPPED.- Parameters:
state- The notification state: must be eitherPushNotificationState.SUCCESSorPushNotificationState.SERVICE_STOPPED- Throws:
java.lang.IllegalArgumentException- For invalidstateasPushNotificationState.ERRORrequires anexception.java.lang.NullPointerException- Ifstateisnull.
PushNotificationEvent
public PushNotificationEvent(java.lang.Throwable exception)
Creates a notification event with exception, i.e. for the statePushNotificationState.ERROR.- Parameters:
exception- The exception, non-null.- Throws:
java.lang.IllegalArgumentException- For invalidstateifexceptionisnull.java.lang.NullPointerException- IfstateisnullorPushNotificationState.ERRORandexceptionisnull.
Method Detail
getState
public PushNotificationState getState()
Gets the notification event type.- Returns:
- The type.
getException
public java.lang.Throwable getException()
Gets the exception in case an error occurred, i.e. ifgetState()returnsPushNotificationState.ERROR.- Returns:
- The exception, or
nullfor none.
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object