public class AppNotification extends GenericParcelable implements Validator, JSONifiable
Modifier and Type | Class and Description |
---|---|
static interface |
AppNotification.Constraints |
JSONifiable.Creator<T>
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<AppNotification> |
CREATOR |
static JSONifiable.Creator<AppNotification> |
JSON_CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | Constructor and Description |
---|---|
|
AppNotification()
Constructs a new empty instance.
|
|
AppNotification(AppNotification src)
Constructs a new instance that is a deep copy of the source instance.
|
protected |
AppNotification(boolean noInit)
Constructs a new empty instance.
|
|
AppNotification(JSONObject jsonObject)
Construct a new instance backed by the given JSONObject, the parameter is not copied so changes to it will be
reflected in this instance and vice-versa.
|
|
AppNotification(String json)
Constructs a new instance from the given JSON String.
|
Modifier and Type | Method and Description |
---|---|
void |
clearApp()
Clears the 'app' field, the 'has' method for this field will now return false
|
void |
clearData()
Clears the 'data' field, the 'has' method for this field will now return false
|
void |
clearEvent()
Clears the 'event' field, the 'has' method for this field will now return false
|
void |
clearTimeToLive()
Clears the 'timeToLive' field, the 'has' method for this field will now return false
|
boolean |
containsChanges()
Returns true if this instance has any changes.
|
AppNotification |
copyChanges()
Create a copy of this instance that contains only fields that were set after the constructor was called.
|
Reference |
getApp()
The app the notification will be sent to.
|
String |
getData()
Payload of the notification.
|
String |
getEvent() |
protected GenericClient |
getGenericClient() |
JSONObject |
getJSONObject()
Returns the internal JSONObject backing this instance, the return value is not a copy so changes to it will be
reflected in this instance and vice-versa.
|
Long |
getTimeToLive()
The time to live of the notification in seconds.
|
boolean |
hasApp()
Checks whether the 'app' field has been set, however the value could be null
|
boolean |
hasData()
Checks whether the 'data' field has been set, however the value could be null
|
boolean |
hasEvent()
Checks whether the 'event' field has been set, however the value could be null
|
boolean |
hasTimeToLive()
Checks whether the 'timeToLive' field has been set, however the value could be null
|
boolean |
isNotNullApp()
Checks whether the 'app' field is set and is not null
|
boolean |
isNotNullData()
Checks whether the 'data' field is set and is not null
|
boolean |
isNotNullEvent()
Checks whether the 'event' field is set and is not null
|
boolean |
isNotNullTimeToLive()
Checks whether the 'timeToLive' field is set and is not null
|
void |
mergeChanges(AppNotification src)
Copy all the changed fields from the given source to this instance.
|
void |
resetChangeLog()
Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
|
AppNotification |
setApp(Reference app)
Sets the field 'app'.
|
AppNotification |
setData(String data)
Sets the field 'data'.
|
AppNotification |
setEvent(String event)
Sets the field 'event'.
|
AppNotification |
setTimeToLive(Long timeToLive)
Sets the field 'timeToLive'.
|
void |
validate() |
describeContents, getBundle, toString, writeToParcel
public static final Parcelable.Creator<AppNotification> CREATOR
public static final JSONifiable.Creator<AppNotification> JSON_CREATOR
public AppNotification()
protected AppNotification(boolean noInit)
public AppNotification(String json) throws IllegalArgumentException
IllegalArgumentException
public AppNotification(JSONObject jsonObject)
public AppNotification(AppNotification src)
public Reference getApp()
public String getEvent()
public Long getTimeToLive()
public String getData()
protected GenericClient getGenericClient()
getGenericClient
in class GenericParcelable
public JSONObject getJSONObject()
getJSONObject
in interface JSONifiable
public boolean isNotNullApp()
public boolean isNotNullEvent()
public boolean isNotNullTimeToLive()
public boolean isNotNullData()
public boolean hasApp()
public boolean hasEvent()
public boolean hasTimeToLive()
public boolean hasData()
public AppNotification setApp(Reference app)
public AppNotification setEvent(String event)
public AppNotification setTimeToLive(Long timeToLive)
public AppNotification setData(String data)
public void clearApp()
public void clearEvent()
public void clearTimeToLive()
public void clearData()
public boolean containsChanges()
public void resetChangeLog()
public AppNotification copyChanges()
public void mergeChanges(AppNotification src)