Class Notification


  • public final class Notification
    extends Request
    Represents a JSON-RPC request without an id, otherwise known as a notification.
    Since:
    0.1.0
    Author:
    Elias*
    See Also:
    JSON-RPC Specification
    • Constructor Detail

      • Notification

        public Notification​(String method)
        Creates a Notification without parameters.
        Parameters:
        method - The non-null method you want to invoke
      • Notification

        public Notification​(String method,
                            com.google.gson.JsonArray params)
        Creates a Notification with parameters in array format.

        If params is null a NullPointerException will be thrown. If you want to create a notification without parameters, you should use Notification(String)

        Parameters:
        method - The non-null method you want to invoke
        params - The parameters provided as JsonArray
      • Notification

        public Notification​(String method,
                            com.google.gson.JsonObject params)
        Creates a Notification with parameters in object format.

        If params is null a NullPointerException will be thrown. If you want to create a notification without parameters, you should use Notification(String)

        Parameters:
        method - The non-null method you want to invoke
        params - The parameters provided as JsonObject
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        This method returns true if the argument is a Notification or Request without an id and all properties are equal, otherwise returns false.

        This method returns true if the argument is a Request and all properties are equal, otherwise returns false.

        Overrides:
        equals in class Request
        Parameters:
        obj - The object to be checked
        Returns:
        Whether this is the same as the Object argument
      • toString

        public String toString()
        The returned String is equal to the value of: "Notification@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString() where contentAsJsonString() returns a JSON-like String of this Notification.
        Overrides:
        toString in class Request
        Returns:
        A String representation of this Notification