Package com.lightstreamer.client.mpn
Class MpnBuilder
java.lang.Object
com.lightstreamer.client.mpn.MpnBuilder
Utility class that provides methods to build or parse the JSON structure used to represent the format of a push notification.
It provides getters and setters for the fields of a push notification, following the format specified by FCM REST API. This format is compatible with
It provides getters and setters for the fields of a push notification, following the format specified by FCM REST API. This format is compatible with
MpnSubscription.setNotificationFormat(String).- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty object to be used to create a push notification format from scratch.
 Use setters methods to set the value of push notification fields.MpnBuilder(String notificationFormat) Creates an object based on the specified push notification format.
 Use getter methods to obtain the value of push notification fields.
- 
Method SummaryModifier and TypeMethodDescriptionbody()Gets the value ofandroid.notification.bodyfield.Sets theandroid.notification.bodyfield.Gets the value ofandroid.notification.body_loc_argsfield.bodyLocArguments(List<String> bodyLocArguments) Sets theandroid.notification.body_loc_argsfield.Gets the value ofandroid.notification.body_loc_keyfield.bodyLocKey(String bodyLocKey) Sets theandroid.notification.body_loc_keyfield.build()Produces the JSON structure for the push notification format specified by this object.Gets the value ofandroid.notification.click_actionfield.clickAction(String clickAction) Sets theandroid.notification.click_actionfield.Gets the value ofandroid.collapse_keyfield.collapseKey(String collapseKey) Sets theandroid.collapse_keyfield.color()Gets the value ofandroid.notification.colorfield.Sets theandroid.notification.colorfield.data()Gets sub-fields of theandroid.datafield.Sets sub-fields of theandroid.datafield.icon()Gets the value ofandroid.notification.iconfield.Sets theandroid.notification.iconfield.priority()Gets the value ofandroid.priorityfield.Sets theandroid.priorityfield.sound()Gets the value ofandroid.notification.soundfield.Sets theandroid.notification.soundfield.tag()Gets the value ofandroid.notification.tagfield.Sets theandroid.notification.tagfield.timeToLive(Integer timeToLive) Sets theandroid.ttlfield with an integer value.timeToLive(String timeToLive) Sets theandroid.ttlfield with a string value.Gets the value ofandroid.ttlfield as an integer.Gets the value ofandroid.ttlfield as a string.title()Gets the value ofandroid.notification.titlefield.Sets theandroid.notification.titlefield.Gets the value ofandroid.notification.title_loc_argsfield.titleLocArguments(List<String> titleLocArguments) Sets theandroid.notification.title_loc_argsfield.Gets the value ofandroid.notification.title_loc_keyfield.titleLocKey(String titleLocKey) Sets theandroid.notification.title_loc_keyfield.
- 
Constructor Details- 
MpnBuilderpublic MpnBuilder()Creates an empty object to be used to create a push notification format from scratch.
 Use setters methods to set the value of push notification fields.
- 
MpnBuilderCreates an object based on the specified push notification format.
 Use getter methods to obtain the value of push notification fields.- Parameters:
- notificationFormat- A JSON structure representing a push notification format.
- Throws:
- IllegalArgumentException- if the notification is not a valid JSON structure.
 
 
- 
- 
Method Details- 
buildProduces the JSON structure for the push notification format specified by this object.- Returns:
- the JSON structure for the push notification format.
 
- 
collapseKeySets theandroid.collapse_keyfield.- Parameters:
- collapseKey- A string to be used for the- android.collapse_keyfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
collapseKeyGets the value ofandroid.collapse_keyfield.- Returns:
- the value of android.collapse_keyfield, or null if absent.
 
- 
prioritySets theandroid.priorityfield.- Parameters:
- priority- A string to be used for the- android.priorityfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
priorityGets the value ofandroid.priorityfield.- Returns:
- the value of android.priorityfield, or null if absent.
 
- 
timeToLiveSets theandroid.ttlfield with a string value.- Parameters:
- timeToLive- A string to be used for the- android.ttlfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
timeToLiveAsStringGets the value ofandroid.ttlfield as a string.- Returns:
- a string with the value of android.ttlfield, or null if absent.
 
- 
timeToLiveSets theandroid.ttlfield with an integer value.- Parameters:
- timeToLive- An integer to be used for the- android.ttlfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
timeToLiveAsIntegerGets the value ofandroid.ttlfield as an integer.- Returns:
- an integer with the value of android.ttlfield, or null if absent.
 
- 
titleSets theandroid.notification.titlefield.- Parameters:
- title- A string to be used for the- android.notification.titlefield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
titleGets the value ofandroid.notification.titlefield.- Returns:
- the value of android.notification.titlefield, or null if absent.
 
- 
titleLocKeySets theandroid.notification.title_loc_keyfield.- Parameters:
- titleLocKey- A string to be used for the- android.notification.title_loc_keyfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
titleLocKeyGets the value ofandroid.notification.title_loc_keyfield.- Returns:
- the value of android.notification.title_loc_keyfield, or null if absent.
 
- 
titleLocArgumentsSets theandroid.notification.title_loc_argsfield.- Parameters:
- titleLocArguments- A list of strings to be used for the- android.notification.title_loc_argsfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
titleLocArgumentsGets the value ofandroid.notification.title_loc_argsfield.- Returns:
- a list of strings with the value of android.notification.title_loc_argsfield, or null if absent.
 
- 
bodySets theandroid.notification.bodyfield.- Parameters:
- body- A string to be used for the- android.notification.bodyfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
bodyGets the value ofandroid.notification.bodyfield.- Returns:
- the value of android.notification.bodyfield, or null if absent.
 
- 
bodyLocKeySets theandroid.notification.body_loc_keyfield.- Parameters:
- bodyLocKey- A string to be used for the- android.notification.body_loc_keyfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
bodyLocKeyGets the value ofandroid.notification.body_loc_keyfield.- Returns:
- the value of android.notification.body_loc_keyfield, or null if absent.
 
- 
bodyLocArgumentsSets theandroid.notification.body_loc_argsfield.- Parameters:
- bodyLocArguments- A list of strings to be used for the- android.notification.body_loc_argsfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
bodyLocArgumentsGets the value ofandroid.notification.body_loc_argsfield.- Returns:
- a list of strings with the value of android.notification.body_loc_argsfield, or null if absent.
 
- 
iconSets theandroid.notification.iconfield.- Parameters:
- icon- A string to be used for the- android.notification.iconfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
iconGets the value ofandroid.notification.iconfield.- Returns:
- the value of android.notification.iconfield, or null if absent.
 
- 
soundSets theandroid.notification.soundfield.- Parameters:
- sound- A string to be used for the- android.notification.soundfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
soundGets the value ofandroid.notification.soundfield.- Returns:
- the value of android.notification.soundfield, or null if absent.
 
- 
tagSets theandroid.notification.tagfield.- Parameters:
- tag- A string to be used for the- android.notification.tagfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
tagGets the value ofandroid.notification.tagfield.- Returns:
- the value of android.notification.tagfield, or null if absent.
 
- 
colorSets theandroid.notification.colorfield.- Parameters:
- color- A string to be used for the- android.notification.colorfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
colorGets the value ofandroid.notification.colorfield.- Returns:
- the value of android.notification.colorfield, or null if absent.
 
- 
clickActionSets theandroid.notification.click_actionfield.- Parameters:
- clickAction- A string to be used for the- android.notification.click_actionfield value, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
clickActionGets the value ofandroid.notification.click_actionfield.- Returns:
- the value of android.notification.click_actionfield, or null if absent.
 
- 
dataSets sub-fields of theandroid.datafield.- Parameters:
- data- A map to be used for sub-fields of the- android.datafield, or null to clear it.
- Returns:
- this MpnBuilder object, for fluent use.
 
- 
dataGets sub-fields of theandroid.datafield.- Returns:
- A map with sub-fields of the android.datafield, or null if absent.
 
 
-