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 aNotification
without parameters.Notification(String method, com.google.gson.JsonArray params)
Creates aNotification
with parameters in array format.Notification(String method, com.google.gson.JsonObject params)
Creates aNotification
with parameters in object format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
This method returnstrue
if the argument is aNotification
orRequest
without an id and all properties are equal, otherwise returnsfalse
.String
toString()
The returnedString
is equal to the value of:"Notification@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString()
wherecontentAsJsonString()
returns a JSON-likeString
of thisNotification
.
-
-
-
Constructor Detail
-
Notification
public Notification(String method)
Creates aNotification
without parameters.- Parameters:
method
- The non-null method you want to invoke
-
Notification
public Notification(String method, com.google.gson.JsonArray params)
Creates aNotification
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 invokeparams
- The parameters provided asJsonArray
-
Notification
public Notification(String method, com.google.gson.JsonObject params)
Creates aNotification
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 invokeparams
- The parameters provided asJsonObject
-
-
Method Detail
-
equals
public boolean equals(Object obj)
This method returnstrue
if the argument is aNotification
orRequest
without an id and all properties are equal, otherwise returnsfalse
.This method returns
true
if the argument is aRequest
and all properties are equal, otherwise returnsfalse
.
-
toString
public String toString()
The returnedString
is equal to the value of:"Notification@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString()
wherecontentAsJsonString()
returns a JSON-likeString
of thisNotification
.- Overrides:
toString
in classRequest
- Returns:
- A
String
representation of thisNotification
-
-