Package com.clover.sdk.v3.apps
Class AppNotification
- java.lang.Object
-
- com.clover.sdk.GenericParcelable
-
- com.clover.sdk.v3.apps.AppNotification
-
- All Implemented Interfaces:
Parcelable
,JSONifiable
,Validator
public class AppNotification extends GenericParcelable implements Validator, JSONifiable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AppNotification.Constraints
-
Nested classes/interfaces inherited from interface com.clover.sdk.JSONifiable
JSONifiable.Creator<T>
-
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<AppNotification>
CREATOR
static JSONifiable.Creator<AppNotification>
JSON_CREATOR
-
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
-
Constructor Summary
Constructors Modifier Constructor Description AppNotification()
Constructs a new empty instance.protected
AppNotification(boolean noInit)
Constructs a new empty instance.AppNotification(AppNotification src)
Constructs a new instance that is a deep copy of the source instance.AppNotification(String json)
Constructs a new instance from the given JSON String.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearApp()
Clears the 'app' field, the 'has' method for this field will now return falsevoid
clearData()
Clears the 'data' field, the 'has' method for this field will now return falsevoid
clearEvent()
Clears the 'event' field, the 'has' method for this field will now return falsevoid
clearTimeToLive()
Clears the 'timeToLive' field, the 'has' method for this field will now return falseboolean
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 nullboolean
hasData()
Checks whether the 'data' field has been set, however the value could be nullboolean
hasEvent()
Checks whether the 'event' field has been set, however the value could be nullboolean
hasTimeToLive()
Checks whether the 'timeToLive' field has been set, however the value could be nullboolean
isNotNullApp()
Checks whether the 'app' field is set and is not nullboolean
isNotNullData()
Checks whether the 'data' field is set and is not nullboolean
isNotNullEvent()
Checks whether the 'event' field is set and is not nullboolean
isNotNullTimeToLive()
Checks whether the 'timeToLive' field is set and is not nullvoid
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()
-
Methods inherited from class com.clover.sdk.GenericParcelable
describeContents, getBundle, toString, writeToParcel
-
-
-
-
Field Detail
-
CREATOR
public static final Parcelable.Creator<AppNotification> CREATOR
-
JSON_CREATOR
public static final JSONifiable.Creator<AppNotification> JSON_CREATOR
-
-
Constructor Detail
-
AppNotification
public AppNotification()
Constructs a new empty instance.
-
AppNotification
protected AppNotification(boolean noInit)
Constructs a new empty instance.
-
AppNotification
public AppNotification(String json) throws IllegalArgumentException
Constructs a new instance from the given JSON String.- Throws:
IllegalArgumentException
-
AppNotification
public 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
public AppNotification(AppNotification src)
Constructs a new instance that is a deep copy of the source instance. It does not copy the bundle or changelog.
-
-
Method Detail
-
getApp
public Reference getApp()
The app the notification will be sent to. This will be autopopulated by the server.
-
getEvent
public String getEvent()
-
getTimeToLive
public Long getTimeToLive()
The time to live of the notification in seconds. By default this is 5 days.
-
getData
public String getData()
Payload of the notification. This is at most 4000 characters.
-
getGenericClient
protected GenericClient getGenericClient()
- Specified by:
getGenericClient
in classGenericParcelable
-
getJSONObject
public 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.- Specified by:
getJSONObject
in interfaceJSONifiable
-
isNotNullApp
public boolean isNotNullApp()
Checks whether the 'app' field is set and is not null
-
isNotNullEvent
public boolean isNotNullEvent()
Checks whether the 'event' field is set and is not null
-
isNotNullTimeToLive
public boolean isNotNullTimeToLive()
Checks whether the 'timeToLive' field is set and is not null
-
isNotNullData
public boolean isNotNullData()
Checks whether the 'data' field is set and is not null
-
hasApp
public boolean hasApp()
Checks whether the 'app' field has been set, however the value could be null
-
hasEvent
public boolean hasEvent()
Checks whether the 'event' field has been set, however the value could be null
-
hasTimeToLive
public boolean hasTimeToLive()
Checks whether the 'timeToLive' field has been set, however the value could be null
-
hasData
public boolean hasData()
Checks whether the 'data' field has been set, however the value could be null
-
setApp
public AppNotification setApp(Reference app)
Sets the field 'app'. The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
-
setEvent
public AppNotification setEvent(String event)
Sets the field 'event'.
-
setTimeToLive
public AppNotification setTimeToLive(Long timeToLive)
Sets the field 'timeToLive'.
-
setData
public AppNotification setData(String data)
Sets the field 'data'.
-
clearApp
public void clearApp()
Clears the 'app' field, the 'has' method for this field will now return false
-
clearEvent
public void clearEvent()
Clears the 'event' field, the 'has' method for this field will now return false
-
clearTimeToLive
public void clearTimeToLive()
Clears the 'timeToLive' field, the 'has' method for this field will now return false
-
clearData
public void clearData()
Clears the 'data' field, the 'has' method for this field will now return false
-
containsChanges
public boolean containsChanges()
Returns true if this instance has any changes.
-
resetChangeLog
public void resetChangeLog()
Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
-
copyChanges
public AppNotification copyChanges()
Create a copy of this instance that contains only fields that were set after the constructor was called.
-
mergeChanges
public void mergeChanges(AppNotification src)
Copy all the changed fields from the given source to this instance.
-
-