Enum PushNotificationParameters
- java.lang.Object
- java.lang.Enum<PushNotificationParameters>
- com.iizix.push.PushNotificationParameters
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PushNotificationParameters>
public enum PushNotificationParameters extends java.lang.Enum<PushNotificationParameters>
The enum used for push notification parameters and if they can be omitted.
Enum Constant Summary
Enum Constants Enum Constant Description BODY
Required message or text of the push notification, a maximum of 5000 characters.ICON
Optional icon, and if specified, must be an SVG icon.ICON_COLOR
Optional icon color.IMAGE
Optional picture to display with the notification.KEY_ALIAS
Required private or alias key for authentication each time a push notification is sent.ORIGIN
Required origin of the notification, generally an IP address.PRIORITY
Optional priority determining where the push notification will be put in the list of notifications (this sorting generally applies to Android devices only).SENDER
Required sender device identification.SOUND
Optional sound to play when notification arrives.TITLE
Notification title (required).URL
Optional URL.URL_TITLE
Optional URL title, if this parameter is specified, the URL will serve as it.VIBRATION
How often the device should vibrate when receiving a push-notification (optional).
Field Summary
Fields Modifier and Type Field Description boolean
isRequired
Required flag.java.lang.String
name
The parameter name (as in name=value).
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Map<PushNotificationParameters,java.lang.String>
parseURL(java.lang.String query)
Parses an encoded URL query string into a parameter array with its values.java.lang.String
toString()
Formats the parameter as a string as PARAM["name",{required|optional}].static java.util.Map<PushNotificationParameters,java.lang.String>
validateParams(java.util.Map<PushNotificationParameters,java.lang.String> params)
Validates a map of push notification parameters.static PushNotificationParameters
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static PushNotificationParameters[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
Enum Constant Detail
TITLE
public static final PushNotificationParameters TITLE
Notification title (required).Server side accepted values are
String
.
BODY
public static final PushNotificationParameters BODY
Required message or text of the push notification, a maximum of 5000 characters. The push notification will show fewer characters depending on the system.Server side accepted values are
String
.
SOUND
public static final PushNotificationParameters SOUND
Optional sound to play when notification arrives.Server side accepted values are
Integer
.
VIBRATION
public static final PushNotificationParameters VIBRATION
How often the device should vibrate when receiving a push-notification (optional). "0" or undefined = device default or a number "1" to "3".This parameter are generally only available for clients on iOS and Android.
Server side accepted values are
Integer
orString
, integer values 0 to 3.
ICON
public static final PushNotificationParameters ICON
Optional icon, and if specified, must be an SVG icon.Server side accepted values are
String
.
ICON_COLOR
public static final PushNotificationParameters ICON_COLOR
Optional icon color.Server side accepted values are
Color
orString
encoded as "#RGB" or "#RRGGBB". The leading '#' can be omitted.
URL
public static final PushNotificationParameters URL
Optional URL.Server side accepted values are
URL
,URI
orString
.
URL_TITLE
public static final PushNotificationParameters URL_TITLE
Optional URL title, if this parameter is specified, the URL will serve as it.Server side accepted values are
String
.
IMAGE
public static final PushNotificationParameters IMAGE
Optional picture to display with the notification.Server side accepted values are
File
orString
.
PRIORITY
public static final PushNotificationParameters PRIORITY
Optional priority determining where the push notification will be put in the list of notifications (this sorting generally applies to Android devices only).Server side accepted values are
Integer
orString
, integer value ranges from -2 = lowest priority to 2 = highest priority, default being zero or normal priority.
SENDER
public static final PushNotificationParameters SENDER
Required sender device identification.Server side accepted values are
String
.
ORIGIN
public static final PushNotificationParameters ORIGIN
Required origin of the notification, generally an IP address.Server side accepted values are
InetAddress
andString
.
KEY_ALIAS
public static final PushNotificationParameters KEY_ALIAS
Required private or alias key for authentication each time a push notification is sent.Server side accepted values are
String
.
Method Detail
values
public static PushNotificationParameters[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PushNotificationParameters c : PushNotificationParameters.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static PushNotificationParameters valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
toString
public java.lang.String toString()
Formats the parameter as a string as PARAM["name",{required|optional}].- Overrides:
toString
in classjava.lang.Enum<PushNotificationParameters>
- Returns:
- A formatted string.
parseURL
public static java.util.Map<PushNotificationParameters,java.lang.String> parseURL(java.lang.String query)
Parses an encoded URL query string into a parameter array with its values.- Parameters:
query
- The query string.- Returns:
- A new validated map of parameters. Values in the map are trimmed for white spaces.
- Throws:
java.lang.IllegalArgumentException
- If an argument is invalid.
validateParams
public static java.util.Map<PushNotificationParameters,java.lang.String> validateParams(java.util.Map<PushNotificationParameters,java.lang.String> params)
Validates a map of push notification parameters.- Parameters:
params
- The map of parameters.- Returns:
- The map of parameters
params
argument. - Throws:
java.lang.IllegalArgumentException
- If a required parameter is not present.