Package com.avaya.core

## Class Message

- java.lang.Object
- - com.avaya.core.Message

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Comparable<Message>`

      public final class Message
      extends java.lang.Object
      implements java.io.Serializable, java.lang.Comparable<Message>

  Object representing a received or sent message
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Message​(Coordinates coordinates, java.util.Map<java.lang.String,​java.lang.Object> metadata)` | Create a message with the given coordinates.
    `Message​(java.lang.String text, java.lang.String payload, java.util.Map<java.lang.String,​java.lang.Object> metadata)` | Create a message with the given text, payload, and metadata.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addMessageAction​(MessageAction messageAction)` | Adds a message action to the list of actions
    `void` | `addMessageItem​(MessageItem messageItem)` | Adds a message item to the list of items
    `int` | `compareTo​(Message o)` |
    `Message` | `copy()` |
    `boolean` | `equals​(java.lang.Object o)` |
    `java.lang.String` | `getAvatarUrl()` | The url for the user's avatar image.
    `Coordinates` | `getCoordinates()` | Returns Coordinates
    `java.util.Date` | `getDate()` | The date and time the message was sent.
    `DisplaySettings` | `getDisplaySettings()` | Returns DisplaySettings for carousel messages
    `MessageDto` | `getEntity()` |
    `java.io.File` | `getFile()` | The file of the message.
    `java.lang.String` | `getId()` | The ID of the message.
    `android.graphics.Bitmap` | `getImage()` | The image of the message.
    `long` | `getMediaSize()` | The media size of the message.
    `java.lang.String` | `getMediaType()` | The media type of the message.
    `java.lang.String` | `getMediaUrl()` | The media URL of the message.
    `java.util.List<MessageAction>` | `getMessageActions()` | The list of Message Action objects contained in the message.
    `java.util.List<MessageItem>` | `getMessageItems()` | The list of Message Item objects contained in the message.
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getMetadata()` | The metadata of the message
    `java.lang.String` | `getName()` | The display name of the user.
    `java.lang.String` | `getPayload()` | The message payload from an action
    `java.lang.String` | `getText()` | The text content of the message.
    `java.lang.String` | `getTextFallback()` | Text to display for unsupported message types
    `java.lang.String` | `getType()` | The message type
    `MessageUploadStatus` | `getUploadStatus()` | The upload status of the message.
    `java.lang.String` | `getUserId()` | The id for the user.
    `java.lang.String` | `getUserRole()` | The Role for the user.
    `int` | `hashCode()` |
    `boolean` | `hasLocationRequest()` | Returns `true` if the message has a location request
    `boolean` | `hasReplies()` | Returns `true` if the message has reply actions
    `boolean` | `hasValidCoordinates()` | Returns `true` if the message has valid coordinates
    `boolean` | `isCarousel()` |
    `boolean` | `isFromCurrentUser()` | Returns true if the message originated from the user, or false if the message comes from another participant.
    `boolean` | `isRead()` | Return true if the message has been read
    `void` | `removeMessageAction​(MessageAction messageAction)` | Removes a message action from the list of actions
    `void` | `removeMessageItem​(MessageItem messageItem)` | Removes a message item from the list of items
    `void` | `setAvatarUrl​(java.lang.String avatarUrl)` | Sets the url for the user's avatar image.
    `void` | `setCoordinates​(Coordinates coordinates)` | Sets the coordinates for the message
    `void` | `setDisplaySettings​(DisplaySettings displaySettings)` | Sets the display settings for the message
    `void` | `setFile​(java.io.File file)` | Sets the file for the message.
    `void` | `setImage​(android.graphics.Bitmap bitmap)` | Sets the image for the message.
    `void` | `setMediaSize​(long mediaSize)` | Sets the media size for the message
    `void` | `setMediaType​(java.lang.String mediaType)` | Sets the media type for the message
    `void` | `setMediaUrl​(java.lang.String mediaUrl)` | Sets the media URL for the message
    `void` | `setMetadata​(java.util.Map<java.lang.String,​java.lang.Object> metadata)` | Sets the metadata for the message
    `void` | `setName​(java.lang.String displayName)` | Sets the user's displayName for the message.
    `void` | `setPayload​(java.lang.String payload)` | Sets the payload for the message
    `void` | `setText​(java.lang.String text)` | Sets the text for the message.
    `void` | `setTextFallback​(java.lang.String textFallback)` | Sets the text to display for unsupported message types
    `void` | `setType​(java.lang.String type)` | Sets the type of the message
    `void` | `setUploadStatus​(MessageUploadStatus uploadStatus)` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Message

          public Message​(java.lang.String text,
                         java.lang.String payload,
                         java.util.Map<java.lang.String,​java.lang.Object> metadata)

      Create a message with the given text, payload, and metadata. The message will be owned by the current user.
      Parameters:
        `text` - The text
        `payload` - The message payload
        `metadata` - The message metadata (JSON Object)

    - #### Message

          public Message​(Coordinates coordinates,
                         java.util.Map<java.lang.String,​java.lang.Object> metadata)

      Create a message with the given coordinates.
      Parameters:
        `coordinates` - The coordinates
        `metadata` - The message metadata (JSON Object)

  - ### Method Detail

    - #### copy

          public Message copy()

    - #### isCarousel

          public boolean isCarousel()

    - #### getAvatarUrl

          public java.lang.String getAvatarUrl()

      The url for the user's avatar image.
      Returns:
        The url

    - #### getUserId

          public java.lang.String getUserId()

      The id for the user.
      Returns:
        The id

    - #### getUserRole

          public java.lang.String getUserRole()

      The Role for the user.
      Returns:
        The Role

    - #### setAvatarUrl

          public void setAvatarUrl​(java.lang.String avatarUrl)

      Sets the url for the user's avatar image.
      Parameters:
        `avatarUrl` - the url for the user's avatar image

    - #### getDate

          public java.util.Date getDate()

      The date and time the message was sent.
      Returns:
        The date

    - #### isFromCurrentUser

          public boolean isFromCurrentUser()

      Returns true if the message originated from the user, or false if the message comes from another participant.
      Returns:
        Is the message from the current user

    - #### getMessageActions

          public java.util.List<MessageAction> getMessageActions()

      The list of Message Action objects contained in the message.
      Returns:
        The message actions

    - #### addMessageAction

          public void addMessageAction​(MessageAction messageAction)

      Adds a message action to the list of actions

    - #### removeMessageAction

          public void removeMessageAction​(MessageAction messageAction)

      Removes a message action from the list of actions

    - #### getMessageItems

          public java.util.List<MessageItem> getMessageItems()

      The list of Message Item objects contained in the message.
      Returns:
        The message items

    - #### addMessageItem

          public void addMessageItem​(MessageItem messageItem)

      Adds a message item to the list of items

    - #### removeMessageItem

          public void removeMessageItem​(MessageItem messageItem)

      Removes a message item from the list of items

    - #### getName

          public java.lang.String getName()

      The display name of the user. This property may be null if no display name could be determined.
      Returns:
        The displayName

    - #### setName

          public void setName​(java.lang.String displayName)

      Sets the user's displayName for the message.

    - #### getText

          public java.lang.String getText()

      The text content of the message.
      Returns:
        The text

    - #### setText

          public void setText​(java.lang.String text)

      Sets the text for the message.

    - #### getUploadStatus

          public MessageUploadStatus getUploadStatus()

      The upload status of the message.
      Returns:
        The status

    - #### setUploadStatus

          public void setUploadStatus​(MessageUploadStatus uploadStatus)

    - #### isRead

          public boolean isRead()

      Return true if the message has been read
      Returns:
        Flag indicating that the message has been read

    - #### getMetadata

          public java.util.Map<java.lang.String,​java.lang.Object> getMetadata()

      The metadata of the message
      Returns:
        The metadata (JSON Object)

    - #### setMetadata

          public void setMetadata​(java.util.Map<java.lang.String,​java.lang.Object> metadata)

      Sets the metadata for the message

    - #### getPayload

          public java.lang.String getPayload()

      The message payload from an action
      Returns:
        The message payload

    - #### setPayload

          public void setPayload​(java.lang.String payload)

      Sets the payload for the message

    - #### getMediaUrl

          public java.lang.String getMediaUrl()

      The media URL of the message.
      Returns:
        The media URL

    - #### setMediaUrl

          public void setMediaUrl​(java.lang.String mediaUrl)

      Sets the media URL for the message

    - #### getMediaType

          public java.lang.String getMediaType()

      The media type of the message.
      Returns:
        The media type

    - #### setMediaType

          public void setMediaType​(java.lang.String mediaType)

      Sets the media type for the message

    - #### getMediaSize

          public long getMediaSize()

      The media size of the message.
      Returns:
        The media size

    - #### setMediaSize

          public void setMediaSize​(long mediaSize)

      Sets the media size for the message

    - #### getId

          public java.lang.String getId()

      The ID of the message.
      Returns:
        The ID

    - #### setImage

          public void setImage​(android.graphics.Bitmap bitmap)

      Sets the image for the message.

    - #### setFile

          public void setFile​(java.io.File file)

      Sets the file for the message.

    - #### getImage

          public android.graphics.Bitmap getImage()

      The image of the message.
      Returns:
        The image

    - #### getFile

          public java.io.File getFile()

      The file of the message.
      Returns:
        The file

    - #### getTextFallback

          public java.lang.String getTextFallback()

      Text to display for unsupported message types
      Returns:
        The text to display

    - #### setTextFallback

          public void setTextFallback​(java.lang.String textFallback)

      Sets the text to display for unsupported message types

    - #### equals

          public boolean equals​(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getEntity

          public MessageDto getEntity()

    - #### getType

          public java.lang.String getType()

      The message type
      Returns:
        The message type
      See Also:
        `MessageType`

    - #### setType

          public void setType​(java.lang.String type)

      Sets the type of the message

    - #### hasReplies

          public boolean hasReplies()

      Returns `true` if the message has reply actions
      Returns:
        `true` if the message has reply actions, `false` otherwise

    - #### hasLocationRequest

          public boolean hasLocationRequest()

      Returns `true` if the message has a location request
      Returns:
        `true` if the message has a location request, `false` otherwise

    - #### getCoordinates

          public Coordinates getCoordinates()

      Returns Coordinates
      Returns:
        Coordinates

    - #### setCoordinates

          public void setCoordinates​(Coordinates coordinates)

      Sets the coordinates for the message

    - #### getDisplaySettings

          public DisplaySettings getDisplaySettings()

      Returns DisplaySettings for carousel messages
      Returns:
        DisplaySettings

    - #### setDisplaySettings

          public void setDisplaySettings​(DisplaySettings displaySettings)

      Sets the display settings for the message

    - #### hasValidCoordinates

          public boolean hasValidCoordinates()

      Returns `true` if the message has valid coordinates
      Returns:
        `true` if the message has valid coordinates, `false` otherwise

    - #### compareTo

          public int compareTo​(Message o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<Message>`