Class JsonrpcObject<IdType>
- java.lang.Object
-
- com.github.jinahya.jsonrpc.bind.v2.JsonrpcObject<IdType>
-
- Type Parameters:
IdType- "id" type parameter
- Direct Known Subclasses:
RequestObject,ResponseObject
public abstract class JsonrpcObject<IdType> extends Object
An abstract class for request objects and response objects.- Author:
- Jin Kwon <onacit_at_gmail.com>
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_NAME_IDThe property name for$.id.static StringPROPERTY_NAME_JSONRPCThe property name for$.jsonrpc.static StringPROPERTY_VALUE_JSONRPCThe fixed value for "jsonrpc" property.
-
Constructor Summary
Constructors Constructor Description JsonrpcObject()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Indicates whether some other object is "equal to" this one.IdTypegetId()Returns the current value of "id" property.StringgetJsonrpc()Returns the current value of "jsonrpc" property.inthashCode()Returns a hash code value for the object.protected @javax.validation.constraints.AssertTrue booleanisIdEitherStringNumberOfNull()Indicates whether the current value of "id" property is, semantically, eitherstring,number, ornull.voidsetId(IdType id)Replaces the current value of "id" property with specified value.voidsetJsonrpc(String jsonrpc)Replaces the current value of "jsonrpc" property with specified value.StringtoString()Returns a string representation of the object.
-
-
-
Field Detail
-
PROPERTY_NAME_JSONRPC
public static final String PROPERTY_NAME_JSONRPC
The property name for$.jsonrpc. The value is "jsonrpc".- See Also:
- Constant Field Values
-
PROPERTY_VALUE_JSONRPC
public static final String PROPERTY_VALUE_JSONRPC
The fixed value for "jsonrpc" property. The value is "2.0".- See Also:
- Constant Field Values
-
PROPERTY_NAME_ID
public static final String PROPERTY_NAME_ID
The property name for$.id. The value is "id".- See Also:
- Constant Field Values
-
-
Method Detail
-
isIdEitherStringNumberOfNull
@AssertTrue protected @javax.validation.constraints.AssertTrue boolean isIdEitherStringNumberOfNull()
Indicates whether the current value of "id" property is, semantically, eitherstring,number, ornull.The
isIdEitherStringNumberOfNull()method ofJsonrpcObjectclass returns the value of following expression.getId() == null || getId() instanceof java.lang.String || getId() instanceof java.lang.Number- Returns:
trueif the value of "id" property is, semantically, eitherstring,number, ornull;falseotherwise.
-
toString
public String toString()
Returns a string representation of the object.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
-
hashCode
public int hashCode()
Returns a hash code value for the object.
-
getJsonrpc
public String getJsonrpc()
Returns the current value of "jsonrpc" property. The default value of the property is "2.0"(PROPERTY_VALUE_JSONRPC).- Returns:
- the current value of "jsonrpc" property.
-
setJsonrpc
public void setJsonrpc(String jsonrpc)
Replaces the current value of "jsonrpc" property with specified value.- Parameters:
jsonrpc- new value for "jsonrpc" property.
-
getId
public IdType getId()
Returns the current value of "id" property.- Returns:
- the current value of "id" property.
-
-