ikrs.json.rpc
Class DefaultJSONRPCResponse

java.lang.Object
  extended by ikrs.json.AbstractJSONValue
      extended by ikrs.json.JSONObject
          extended by ikrs.json.rpc.DefaultJSONRPCResponse
All Implemented Interfaces:
JSONValue, JSONRPCResponse

public class DefaultJSONRPCResponse
extends JSONObject
implements JSONRPCResponse


Field Summary
 
Fields inherited from interface ikrs.json.JSONValue
FALSE, NULL, TRUE, TYPE_ARRAY, TYPE_BOOLEAN, TYPE_NULL, TYPE_NUMBER, TYPE_OBJECT, TYPE_STRING
 
Constructor Summary
DefaultJSONRPCResponse(JSONValue result, JSONValue error, JSONValue id)
           
 
Method Summary
 JSONValue getError()
          Get the error object from the response (if result is null).
 JSONValue getID()
          Get the ID of this response.
 JSONValue getResult()
          Get the RPC result of the call.
 JSONValue getVersion()
          This method returns the value of the 'jsonrpc' field from this request.
 
Methods inherited from class ikrs.json.JSONObject
asJSONArray, asJSONObject, getMap, getObject, main, toString, write
 
Methods inherited from class ikrs.json.AbstractJSONValue
asJSONBoolean, asJSONNumber, asJSONString, getArray, getBoolean, getNumber, getString, getTypeName, isArray, isBoolean, isNull, isNumber, isObject, isString, isValidTypeID, toJSONString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ikrs.json.JSONValue
asJSONArray, asJSONBoolean, asJSONNumber, asJSONObject, asJSONString, getArray, getBoolean, getNumber, getObject, getString, isArray, isBoolean, isNull, isNumber, isObject, isString, toJSONString, write
 

Constructor Detail

DefaultJSONRPCResponse

public DefaultJSONRPCResponse(JSONValue result,
                              JSONValue error,
                              JSONValue id)
Method Detail

getVersion

public JSONValue getVersion()
This method returns the value of the 'jsonrpc' field from this request.

Specified by:
getVersion in interface JSONRPCResponse
Returns:
null if the request has no 'jsonrpc' field.

getResult

public JSONValue getResult()
Get the RPC result of the call. Due to the specification the result MUST be null if there were errors.

Specified by:
getResult in interface JSONRPCResponse
Returns:
The RPC result or JSON-null/Java-null on errors.

getError

public JSONValue getError()
Get the error object from the response (if result is null). Due to the specification the error object MUST be null if there were no errors.

Specified by:
getError in interface JSONRPCResponse
Returns:
The error result if there were errors.

getID

public JSONValue getID()
Get the ID of this response. Each response identifies the related request by the use of it's unique ID. Note that 'notifications' are special requests that expect no response. A notification is a request without an ID. Server MUST NOT response to notifications.

Specified by:
getID in interface JSONRPCResponse
Returns:
The ID of this response (must not be null).