Package com.thetransactioncompany.jsonrpc2.util
Utility classes for typed retrieval of JSON-RPC 2.0 request parameters on the
server side.
The following parameter type conversion choices are available:
- JSON true/false to Java
boolean
- JSON number to Java
int
,long
,float
ordouble
- JSON string to
java.lang.String
- Predefined (enumerated) JSON string to a Java
enum
constant orjava.lang.String
- JSON array to Java
boolean[]
,int[]
,long[]
,float[]
,double[]
orstring[]
array, or to mixed typejava.util.List
- JSON object to
java.util.Map
If a parameter cannot be retrieved, either because it's missing or
is of the wrong type, a standard
JSONRPC2Error.INVALID_PARAMS
exception is thrown.
There are two concrete classes:
- The
PositionalParamsRetriever
class is for extracting positional parameters (packed in a JSON array). - The
NamedParamsRetriever
class is for extracting named parameters (packed in a JSON object).
Package dependencies: The classes in this package depend on the
sister com.thetransactioncompany.jsonrpc2
package.
- Author:
- Vladimir Dzhuvinov
-
Class Summary Class Description NamedParamsRetriever Utility class for retrieving JSON-RPC 2.0 named parameters (key-value pairs packed into a JSON Object).ParamsRetriever The base abstract class for the JSON-RPC 2.0 parameter retrievers.PositionalParamsRetriever Utility class for retrieving JSON-RPC 2.0 positional parameters (packed into a JSON Array).