# Class PushMessage

java.lang.Object
com.codename1.push.PushMessage

public final class PushMessage extends Object

Immutable typed push message used by clients and sending code.

Common fields are provider-independent. Provider-specific options belong under `PushMessage.Builder.platform(String, Map)`. Received JSON must contain a supported schema number and is exposed as immutable maps and lists.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `PushMessage.Builder`
  Builds an immutable `PushMessage`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `SCHEMA_VERSION`
  Current JSON envelope schema.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static PushMessage.Builder`
  `builder()`
  Creates a message builder initialized with the current schema.
  `String`
  `getBody()`
  `String`
  `getCollapseKey()`
  `Map<String,Object>`
  `getData()`
  `String`
  `getDeepLink()`
  `String`
  `getId()`
  `String`
  `getImageUrl()`
  `Map<String,Object>`
  `getPlatformOptions()`
  `Map<String,Object>`
  `getSurface()`
  `String`
  `getTitle()`
  `static PushMessage`
  `parse(String json)`
  Parses a schema-3 JSON envelope.
  `String`
  `toJson()`
  `Map<String,Object>`
  `toMap()`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SCHEMA_VERSION

    public static final int SCHEMA_VERSION
    Current JSON envelope schema.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### builder

    public static PushMessage.Builder builder()
    Creates a message builder initialized with the current schema.
    Returns:
      a new builder

  - ### parse

    public static PushMessage parse(String json) throws IOException
    Parses a schema-3 JSON envelope.
    Parameters:
      `json` - complete JSON object
    Returns:
      an immutable message
    Throws:
      `IOException` - if JSON is empty, invalid, or has an unsupported schema

  - ### getId

    public String getId()
    Returns:
      the message identifier, or `null`

  - ### getTitle

    public String getTitle()
    Returns:
      the visible notification title, or `null`

  - ### getBody

    public String getBody()
    Returns:
      the visible notification body, or `null`

  - ### getImageUrl

    public String getImageUrl()
    Returns:
      the rich-notification image URL, or `null`

  - ### getDeepLink

    public String getDeepLink()
    Returns:
      the application deep link, or `null`

  - ### getCollapseKey

    public String getCollapseKey()
    Returns:
      the provider collapse key, or `null`

  - ### getData

    public Map<String,Object> getData()
    Returns:
      immutable application data, possibly empty

  - ### getSurface

    public Map<String,Object> getSurface()
    Returns:
      immutable widget or live-surface command data, possibly empty

  - ### getPlatformOptions

    public Map<String,Object> getPlatformOptions()
    Returns:
      immutable provider-specific options keyed by provider

  - ### toMap

    public Map<String,Object> toMap()
    Returns:
      the complete immutable envelope

  - ### toJson

    public String toJson()
    Returns:
      this message encoded as JSON