Package eliasstar.jsonrpc.objects
Class Notification
- java.lang.Object
-
- eliasstar.jsonrpc.objects.Request
-
- eliasstar.jsonrpc.objects.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 Summary
Constructors Constructor Description Notification(String method)Creates aNotificationwithout parameters.Notification(String method, com.google.gson.JsonArray params)Creates aNotificationwith parameters in array format.Notification(String method, com.google.gson.JsonObject params)Creates aNotificationwith parameters in object format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)This method returnstrueif the argument is aNotificationorRequestwithout an id and all properties are equal, otherwise returnsfalse.StringtoString()The returnedStringis equal to the value of:"Notification@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString()wherecontentAsJsonString()returns a JSON-likeStringof thisNotification.
-
-
-
Constructor Detail
-
Notification
public Notification(String method)
Creates aNotificationwithout parameters.- Parameters:
method- The non-null method you want to invoke
-
Notification
public Notification(String method, com.google.gson.JsonArray params)
Creates aNotificationwith 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 invokeparams- The parameters provided asJsonArray
-
Notification
public Notification(String method, com.google.gson.JsonObject params)
Creates aNotificationwith 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 invokeparams- The parameters provided asJsonObject
-
-
Method Detail
-
equals
public boolean equals(Object obj)
This method returnstrueif the argument is aNotificationorRequestwithout an id and all properties are equal, otherwise returnsfalse.This method returns
trueif the argument is aRequestand all properties are equal, otherwise returnsfalse.
-
toString
public String toString()
The returnedStringis equal to the value of:"Notification@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString()wherecontentAsJsonString()returns a JSON-likeStringof thisNotification.- Overrides:
toStringin classRequest- Returns:
- A
Stringrepresentation of thisNotification
-
-