ikrs.json.rpc
Class DefaultJSONRPCRequest

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

public class DefaultJSONRPCRequest
extends JSONObject
implements JSONRPCRequest


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
DefaultJSONRPCRequest()
           
DefaultJSONRPCRequest(java.lang.String method, JSONArray params, java.lang.Number id)
           
 
Method Summary
 JSONValue getID()
          Get the ID of this resquest.
 JSONValue getMethod()
          Get the request's method name.
 JSONValue getParams()
          Get the request's method params.
 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

DefaultJSONRPCRequest

public DefaultJSONRPCRequest()

DefaultJSONRPCRequest

public DefaultJSONRPCRequest(java.lang.String method,
                             JSONArray params,
                             java.lang.Number id)
Method Detail

getVersion

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

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

getMethod

public JSONValue getMethod()
Get the request's method name. Note that method names are case sensitive in RPC requests!

Specified by:
getMethod in interface JSONRPCRequest
Returns:
null if no method field is present.

getParams

public JSONValue getParams()
Get the request's method params. Due to the specification there are two possible ways to pass params: (A) as JSON array (addressed by array indices). (B) as JSON object (addressed by member names).

Specified by:
getParams in interface JSONRPCRequest
Returns:
The RPC params of this request (must be array or object).

getID

public JSONValue getID()
Get the ID of this resquest. 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 JSONRPCRequest
Returns:
The ID of this request. The ID is null if this request is a notification.