Package com.iizix.push
Class PushNotificationEvent
- java.lang.Object
- com.iizix.push.PushNotificationEvent
public class PushNotificationEvent extends java.lang.Object
Push 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.Throwable
exception
The exception thrown in case ofPushNotificationState.ERROR
,null
otherwise.PushNotificationState
state
The 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 boolean
equals(java.lang.Object obj)
java.lang.Throwable
getException()
Gets the exception in case an error occurred, i.e.PushNotificationState
getState()
Gets the notification event type.int
hashCode()
java.lang.String
toString()
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
,null
otherwise.
Constructor Detail
PushNotificationEvent
public PushNotificationEvent(PushNotificationState state)
Creates a notification event without exception, e.g. for the typesPushNotificationState.SUCCESS
orPushNotificationState.SERVICE_STOPPED
.- Parameters:
state
- The notification state: must be eitherPushNotificationState.SUCCESS
orPushNotificationState.SERVICE_STOPPED
- Throws:
java.lang.IllegalArgumentException
- For invalidstate
asPushNotificationState.ERROR
requires anexception
.java.lang.NullPointerException
- Ifstate
isnull
.
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 invalidstate
ifexception
isnull
.java.lang.NullPointerException
- Ifstate
isnull
orPushNotificationState.ERROR
andexception
isnull
.
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
null
for none.
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object