Class PushMessage


  • public class PushMessage
    extends Object

    This class represents a push message to be encrypted.

    Thread Safety:

    Instances of this class are immutable. So they are thread-safe.

    Author:
    Tomoki Sato
    See Also:
    MessageEncryption
    • Method Detail

      • of

        public static PushMessage of​(byte[] messageBytes)
        Creates a new PushMessage with the given octet sequence.
        Parameters:
        messageBytes - the octet sequence representing a push message.
        Returns:
        a new PushMessage.
        Throws:
        IllegalArgumentException - if the given octet sequence is null or empty.
      • ofUTF8

        public static PushMessage ofUTF8​(String messageText)
        Creates a new PushMessage with the given text. The given text is encoded by using UTF-8.
        Parameters:
        messageText - the text representing a push message.
        Returns:
        a new PushMessage.
        Throws:
        IllegalArgumentException - if the given text is null or empty.
      • equals

        public boolean equals​(Object o)
        Compares the given object with this object based on their underlying messages.
        Overrides:
        equals in class Object
        Parameters:
        o - an object.
        Returns:
        true if the given object is equal to this object
      • hashCode

        public int hashCode()
        Returns the hash code value for this object based on its underlying message.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code value for this object.