Class ResponseObject<ResultType,ErrorType extends ResponseObject.ErrorObject<?>,IdType>
- java.lang.Object
-
- com.github.jinahya.jsonrpc.bind.v2.JsonrpcObject<IdType>
-
- com.github.jinahya.jsonrpc.bind.v2.ResponseObject<ResultType,ErrorType,IdType>
-
- Type Parameters:
ResultType- "result" type parameterErrorType- "error" type parameterIdType- "id" type parameter
public class ResponseObject<ResultType,ErrorType extends ResponseObject.ErrorObject<?>,IdType> extends JsonrpcObject<IdType>
A class for binding response objects.- Author:
- Jin Kwon <onacit_at_gmail.com>
- See Also:
- Response Object (JSON-RPC 2.0 Specification)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResponseObject.ErrorObject<DataType>A class for binding "error" property of response objects.
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_NAME_ERRORThe property name for$.error.static StringPROPERTY_NAME_RESULTThe property name for$.result.-
Fields inherited from class com.github.jinahya.jsonrpc.bind.v2.JsonrpcObject
PROPERTY_NAME_ID, PROPERTY_NAME_JSONRPC, PROPERTY_VALUE_JSONRPC
-
-
Constructor Summary
Constructors Constructor Description ResponseObject()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.ErrorTypegetError()Returns the current value of "error" property.ResultTypegetResult()Returns the current value of "result" property.inthashCode()Returns a hash code value for the object.protected booleanisErrorNull()Indicates whether the current value of "error" property is semanticallynull.protected @javax.validation.constraints.AssertTrue booleanisResultErrorExclusive()protected booleanisResultNull()Indicates whether the current value of "result" property is semanticallynull.voidsetError(ErrorType error)Replaces the current value of "error" property with specified value.voidsetResult(ResultType result)Replaces the current value of "result" property with specified value.StringtoString()Returns a string representation of the object.-
Methods inherited from class com.github.jinahya.jsonrpc.bind.v2.JsonrpcObject
getId, getJsonrpc, isIdEitherStringNumberOfNull, setId, setJsonrpc
-
-
-
-
Field Detail
-
PROPERTY_NAME_RESULT
public static final String PROPERTY_NAME_RESULT
The property name for$.result. The value is "result".- See Also:
- Constant Field Values
-
PROPERTY_NAME_ERROR
public static final String PROPERTY_NAME_ERROR
The property name for$.error. The value is "error".- See Also:
- Constant Field Values
-
-
Method Detail
-
toString
public String toString()
Returns a string representation of the object.- Overrides:
toStringin classJsonrpcObject<IdType>- Returns:
- a string representation of the object.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.- Overrides:
equalsin classJsonrpcObject<IdType>- Parameters:
obj- the reference object with which to compare.- Returns:
trueif this object is the same as theobjargument;falseotherwise.
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCodein classJsonrpcObject<IdType>- Returns:
- a hash code value for this object.
-
isResultNull
protected boolean isResultNull()
Indicates whether the current value of "result" property is semanticallynull.The
isResultNull()method ofResponseObjectclass returns the value of following expression.getResult() == null- Returns:
trueif the current value of "result" property is semanticallynull;falseotherwise.
-
isErrorNull
protected boolean isErrorNull()
Indicates whether the current value of "error" property is semanticallynull.The
isErrorNull()method ofResponseObjectclass returns the value of following expression.getError() == null- Returns:
trueif the current value of "error" property is semanticallynull;falseotherwise.
-
isResultErrorExclusive
@AssertTrue protected @javax.validation.constraints.AssertTrue boolean isResultErrorExclusive()
Indicates either "result" property or "error" property is set exclusively. TheisResultErrorExclusive()method ofResponseObjectclass returns the value of following expression.isResultNull() ^ isErrorNull()- Returns:
trueif either "result" property or "error" property is set exclusively;falseotherwise.- See Also:
isResultNull(),isErrorNull()
-
getResult
public ResultType getResult()
Returns the current value of "result" property.- Returns:
- the current value of "result" property.
-
setResult
public void setResult(ResultType result)
Replaces the current value of "result" property with specified value.- Parameters:
result- new value for "result" property.
-
getError
public ErrorType getError()
Returns the current value of "error" property.- Returns:
- the current value of "error" property.
-
-