|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.thetransactioncompany.jsonrpc2.util.ParamsRetriever
com.thetransactioncompany.jsonrpc2.util.NamedParamsRetriever
public class NamedParamsRetriever
Utility class for retrieving JSON-RPC 2.0 named parameters (key-value pairs packed into a JSON Object).
Provides a set of getter methods according to the expected parameter type (number, string, etc.) and whether the parameter is mandatory or optional:
getXXX(param_name) for mandatory parameters, where XXX
is the expected parameter type.getOptXXX(param_name, default_value) for optional parameters,
specifying a default value.There are also generic getter methods that let you do the type conversion yourself.
If a parameter cannot be retrieved, e.g. due to a missing mandatory
parameter or bad type, a
JSONRPC2Error.INVALID_PARAMS
exception is thrown.
Example: suppose you have a method with 3 named parameters "name", "age" and "sex", where the last is optional and defaults to "female":
// Parse received request string
JSONRPC2Request request = null;
try {
request = JSONRPC2Request.parse(jsonString);
} catch (JSONRPC2ParseException e) {
// handle exception...
}
// Create a new retriever for named parameters
Map params = (Map)request.getParams();
NamedParamsRetriever r = new NamedParamsRetriever(params);
try {
// Extract "name" string parameter
String name = r.getString("name");
// Extract "age" integer parameter
int age = r.getInt("age");
// Extract optional "sex" string parameter which defaults to "female"
String sex = r.getOptString("sex", "female");
} catch (JSONRPC2Error e) {
// A JSONRPC2Error.INVALID_PARAMS will be thrown to indicate
// an unexpected parameter type or a missing mandatory parameter.
// You can use it straight away to create the appropriate
// JSON-RPC 2.0 error response.
JSONRPC2Response response = new JSONRPC2Response(e, null);
}
| Constructor Summary | |
|---|---|
NamedParamsRetriever(java.util.Map<java.lang.String,java.lang.Object> params)
Creates a new named parameters retriever from the specified key-value map. |
|
| Method Summary | ||
|---|---|---|
void |
ensureParameter(java.lang.String name)
Throws a JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name. |
|
|
ensureParameter(java.lang.String name,
java.lang.Class<T> clazz)
Throws a JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name, its value is null, or
its type doesn't map to the specified. |
|
|
ensureParameter(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull)
Throws a JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name or its type doesn't map to the
specified. |
|
void |
ensureParameters(java.lang.String[] mandatoryNames)
Throws a JSONRPC2Error.INVALID_PARAMS if the specified
names aren't present in the parameters, or names outside the
specified are contained. |
|
void |
ensureParameters(java.lang.String[] mandatoryNames,
java.lang.String[] optionalNames)
Throws a JSONRPC2Error.INVALID_PARAMS if the specified
mandatory names aren't contained in the parameters, or names outside
the specified mandatory and optional are present. |
|
java.lang.Object |
get(java.lang.String name)
Retrieves the specified parameter which can be of any type. |
|
|
get(java.lang.String name,
java.lang.Class<T> clazz)
Retrieves the specified parameter which must map to the provided class (use the appropriate wrapper class for primitive types). |
|
|
get(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull)
Retrieves the specified parameter which must map to the provided class (use the appropriate wrapper class for primitive types). |
|
boolean |
getBoolean(java.lang.String name)
Retrieves the specified boolean (maps from JSON true/false) parameter. |
|
double |
getDouble(java.lang.String name)
Retrieves the specified numeric parameter as a double. |
|
|
getEnum(java.lang.String name,
java.lang.Class<T> enumClass)
Retrieves the specified enumerated parameter (from a JSON string that has a predefined set of possible values). |
|
|
getEnum(java.lang.String name,
java.lang.Class<T> enumClass,
boolean ignoreCase)
Retrieves the specified enumerated parameter (from a JSON string that has a predefined set of possible values), allowing for a case insensitive match. |
|
java.lang.String |
getEnumString(java.lang.String name,
java.lang.String[] enumStrings)
Retrieves the specified enumerated string parameter. |
|
java.lang.String |
getEnumString(java.lang.String name,
java.lang.String[] enumStrings,
boolean ignoreCase)
Retrieves the specified enumerated string parameter, allowing for a case insenstive match. |
|
float |
getFloat(java.lang.String name)
Retrieves the specified numeric parameter as a float. |
|
int |
getInt(java.lang.String name)
Retrieves the specified numeric parameter as an int. |
|
java.util.List<java.lang.Object> |
getList(java.lang.String name)
Retrieves the specified list (maps from JSON array) parameter. |
|
java.util.List<java.lang.Object> |
getList(java.lang.String name,
boolean allowNull)
Retrieves the specified list (maps from JSON array) parameter. |
|
long |
getLong(java.lang.String name)
Retrieves the specified numeric parameter as a long. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getMap(java.lang.String name)
Retrieves the specified map (maps from JSON object) parameter. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getMap(java.lang.String name,
boolean allowNull)
Retrieves the specified map (maps from JSON object) parameter. |
|
java.lang.String[] |
getNames()
Returns the names of all available parameters. |
|
|
getOpt(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull,
T defaultValue)
Retrieves the specified optional parameter which must map to the provided class (use the appropriate wrapper class for primitive types). |
|
|
getOpt(java.lang.String name,
java.lang.Class<T> clazz,
T defaultValue)
Retrieves the specified optional parameter which must map to the provided class (use the appropriate wrapper class for primitive types). |
|
boolean |
getOptBoolean(java.lang.String name,
boolean defaultValue)
Retrieves the specified optional boolean (maps from JSON true/false) parameter. |
|
double |
getOptDouble(java.lang.String name,
double defaultValue)
Retrieves the specified optional numeric parameter as a double. |
|
|
getOptEnum(java.lang.String name,
java.lang.Class<T> enumClass,
T defaultValue)
Retrieves the specified optional enumerated parameter (from a JSON string that has a predefined set of possible values). |
|
|
getOptEnum(java.lang.String name,
java.lang.Class<T> enumClass,
T defaultValue,
boolean ignoreCase)
Retrieves the specified optional enumerated parameter (from a JSON string that has a predefined set of possible values), allowing for a case insenstive match. |
|
java.lang.String |
getOptEnumString(java.lang.String name,
java.lang.String[] enumStrings,
java.lang.String defaultValue)
Retrieves the specified optional enumerated string parameter. |
|
java.lang.String |
getOptEnumString(java.lang.String name,
java.lang.String[] enumStrings,
java.lang.String defaultValue,
boolean ignoreCase)
Retrieves the specified optional enumerated string parameter, allowing for a case insenstive match. |
|
float |
getOptFloat(java.lang.String name,
float defaultValue)
Retrieves the specified optional numeric parameter as a float. |
|
int |
getOptInt(java.lang.String name,
int defaultValue)
Retrieves the specified optional numeric parameter as an int. |
|
java.util.List<java.lang.Object> |
getOptList(java.lang.String name,
boolean allowNull,
java.util.List<java.lang.Object> defaultValue)
Retrieves the specified optional list (maps from JSON array) parameter. |
|
java.util.List<java.lang.Object> |
getOptList(java.lang.String name,
java.util.List<java.lang.Object> defaultValue)
Retrieves the specified optional list (maps from JSON array) parameter. |
|
long |
getOptLong(java.lang.String name,
long defaultValue)
Retrieves the specified optional numeric parameter as a long. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getOptMap(java.lang.String name,
boolean allowNull,
java.util.Map<java.lang.String,java.lang.Object> defaultValue)
Retrieves the specified optional map (maps from JSON object) parameter. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getOptMap(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> defaultValue)
Retrieves the specified optional map (maps from JSON object) parameter. |
|
java.lang.String |
getOptString(java.lang.String name,
boolean allowNull,
java.lang.String defaultValue)
Retrieves the specified optional string parameter. |
|
java.lang.String |
getOptString(java.lang.String name,
java.lang.String defaultValue)
Retrieves the specified optional string parameter. |
|
java.lang.String[] |
getOptStringArray(java.lang.String name,
boolean allowNull,
java.lang.String[] defaultValue)
Retrieves the specified optional string array (maps from JSON array of strings) parameter. |
|
java.lang.String[] |
getOptStringArray(java.lang.String name,
java.lang.String[] defaultValue)
Retrieves the specified optional string array (maps from JSON array of strings) parameter. |
|
java.lang.String |
getString(java.lang.String name)
Retrieves the specified string parameter. |
|
java.lang.String |
getString(java.lang.String name,
boolean allowNull)
Retrieves the specified string parameter. |
|
java.lang.String[] |
getStringArray(java.lang.String name)
Retrieves the specified string array (maps from JSON array of strings) parameter. |
|
java.lang.String[] |
getStringArray(java.lang.String name,
boolean allowNull)
Retrieves the specified string array (maps from JSON array of strings) parameter. |
|
boolean |
hasParameter(java.lang.String name)
Returns true if a parameter by the specified name exists,
else false. |
|
boolean |
hasParameters(java.lang.String[] names)
Returns true if the parameters by the specified names exist,
else false. |
|
boolean |
hasParameters(java.lang.String[] mandatoryNames,
java.lang.String[] optionalNames)
Returns true if the parameters by the specified mandatory
names exist, false if any mandatory name is missing or a name
outside the mandatory and optional is present. |
|
int |
size()
Returns the number of available named parameters. |
|
| Methods inherited from class com.thetransactioncompany.jsonrpc2.util.ParamsRetriever |
|---|
ensureEnumString, ensureEnumString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NamedParamsRetriever(java.util.Map<java.lang.String,java.lang.Object> params)
params - The named parameters map.| Method Detail |
|---|
public int size()
size in class ParamsRetrieverpublic boolean hasParameter(java.lang.String name)
true if a parameter by the specified name exists,
else false.
name - The parameter name.
true if the parameter exists, else false.public boolean hasParameters(java.lang.String[] names)
true if the parameters by the specified names exist,
else false.
names - The parameter names.
true if the parameters exist, else false.
public boolean hasParameters(java.lang.String[] mandatoryNames,
java.lang.String[] optionalNames)
true if the parameters by the specified mandatory
names exist, false if any mandatory name is missing or a name
outside the mandatory and optional is present.
mandatoryNames - The expected mandatory parameter names.optionalNames - The expected optional parameter names,
empty array or null if none.
true if the specified mandatory names and only any of
the optional are present, else false.public java.lang.String[] getNames()
public void ensureParameters(java.lang.String[] mandatoryNames)
throws JSONRPC2Error
JSONRPC2Error.INVALID_PARAMS if the specified
names aren't present in the parameters, or names outside the
specified are contained.
You may use this method to a fire a proper JSON-RPC 2.0 error on a missing or unexpected mandatory parameter name.
mandatoryNames - The expected parameter names.
JSONRPC2Error - On a missing parameter name or names outside
the specified
(JSONRPC2Error.INVALID_PARAMS).
public void ensureParameters(java.lang.String[] mandatoryNames,
java.lang.String[] optionalNames)
throws JSONRPC2Error
JSONRPC2Error.INVALID_PARAMS if the specified
mandatory names aren't contained in the parameters, or names outside
the specified mandatory and optional are present.
You may use this method to a fire a proper JSON-RPC 2.0 error on a missing or unexpected mandatory parameter name.
mandatoryNames - The expected mandatory parameter names.optionalNames - The expected optional parameter names,
empty array or null if none.
JSONRPC2Error - On a missing mandatory parameter name or names
outside the specified mandatory and optional
(JSONRPC2Error.INVALID_PARAMS).
public void ensureParameter(java.lang.String name)
throws JSONRPC2Error
JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name.
You may use this method to fire the proper JSON-RPC 2.0 error on a missing mandatory parameter.
name - The parameter name.
JSONRPC2Error - On a missing parameter
(JSONRPC2Error.INVALID_PARAMS).
public <T> void ensureParameter(java.lang.String name,
java.lang.Class<T> clazz)
throws JSONRPC2Error
JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name, its value is null, or
its type doesn't map to the specified.
You may use this method to fire the proper JSON-RPC 2.0 error on a missing or badly-typed mandatory parameter.
name - The parameter name.clazz - The corresponding Java class that the parameter should
map to (any one of the return types of the getXXX()
getter methods. Set to Object.class to allow any
type.
JSONRPC2Error - On a missing parameter, null value or
bad type (JSONRPC2Error.INVALID_PARAMS).
public <T> void ensureParameter(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull)
throws JSONRPC2Error
JSONRPC2Error.INVALID_PARAMS exception if there is
no parameter by the specified name or its type doesn't map to the
specified.
You may use this method to fire the proper JSON-RPC 2.0 error on a missing or badly-typed mandatory parameter.
name - The parameter name.clazz - The corresponding Java class that the parameter
should map to (any one of the return types of the
getXXX() getter methods. Set to
Object.class to allow any type.allowNull - If true allows a null parameter
value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.Object get(java.lang.String name)
throws JSONRPC2Error
get* methods.
name - The parameter name.
JSONRPC2Error - On a missing parameter
(JSONRPC2Error.INVALID_PARAMS).
public <T> T get(java.lang.String name,
java.lang.Class<T> clazz)
throws JSONRPC2Error
name - The parameter name.clazz - The corresponding Java class that the parameter should
map to (any one of the return types of the getXXX()
getter methods. Set to Object.class to allow any
type.
JSONRPC2Error - On a missing parameter, null value or
bad type (JSONRPC2Error.INVALID_PARAMS).
public <T> T get(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull)
throws JSONRPC2Error
name - The parameter name.clazz - The corresponding Java class that the parameter
should map to (any one of the return types of the
getXXX() getter methods. Set to
Object.class to allow any type.allowNull - If true allows a null parameter
value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public <T> T getOpt(java.lang.String name,
java.lang.Class<T> clazz,
T defaultValue)
throws JSONRPC2Error
name - The parameter name.clazz - The corresponding Java class that the parameter
should map to (any one of the return types of the
getXXX() getter methods. Set to
Object.class to allow any type.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public <T> T getOpt(java.lang.String name,
java.lang.Class<T> clazz,
boolean allowNull,
T defaultValue)
throws JSONRPC2Error
name - The parameter name.clazz - The corresponding Java class that the parameter
should map to (any one of the return types of the
getXXX() getter methods. Set to
Object.class to allow any type.allowNull - If true allows a null parameter
value.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getString(java.lang.String name)
throws JSONRPC2Error
name - The parameter name.
JSONRPC2Error - On a missing parameter, bad type or null
value (JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getString(java.lang.String name,
boolean allowNull)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getOptString(java.lang.String name,
java.lang.String defaultValue)
throws JSONRPC2Error
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad type or null value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getOptString(java.lang.String name,
boolean allowNull,
java.lang.String defaultValue)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad type (JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getEnumString(java.lang.String name,
java.lang.String[] enumStrings)
throws JSONRPC2Error
name - The parameter name.enumStrings - The acceptable string values.
JSONRPC2Error - On a missing parameter, bad type or
bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getEnumString(java.lang.String name,
java.lang.String[] enumStrings,
boolean ignoreCase)
throws JSONRPC2Error
name - The parameter name.enumStrings - The acceptable string values.ignoreCase - true for a case insensitive match.
JSONRPC2Error - On a missing parameter, bad type or
bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getOptEnumString(java.lang.String name,
java.lang.String[] enumStrings,
java.lang.String defaultValue)
throws JSONRPC2Error
name - The parameter name.enumStrings - The acceptable string values.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad type or bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String getOptEnumString(java.lang.String name,
java.lang.String[] enumStrings,
java.lang.String defaultValue,
boolean ignoreCase)
throws JSONRPC2Error
name - The parameter name.enumStrings - The acceptable string values.defaultValue - The default return value if the parameter
doesn't exist. May be null.ignoreCase - true for a case insensitive match.
JSONRPC2Error - On a bad type or bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public <T extends java.lang.Enum<T>> T getEnum(java.lang.String name,
java.lang.Class<T> enumClass)
throws JSONRPC2Error
name - The parameter name.enumClass - An enumeration type with constant names representing
the acceptable string values.
JSONRPC2Error - On a missing parameter, bad type or
bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public <T extends java.lang.Enum<T>> T getEnum(java.lang.String name,
java.lang.Class<T> enumClass,
boolean ignoreCase)
throws JSONRPC2Error
name - The parameter name.enumClass - An enumeration type with constant names representing
the acceptable string values.ignoreCase - If true a case insensitive match against
the acceptable constant names is performed.
JSONRPC2Error - On a missing parameter, bad type or
bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public <T extends java.lang.Enum<T>> T getOptEnum(java.lang.String name,
java.lang.Class<T> enumClass,
T defaultValue)
throws JSONRPC2Error
name - The parameter name.enumClass - An enumeration type with constant names representing
the acceptable string values.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad type or bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public <T extends java.lang.Enum<T>> T getOptEnum(java.lang.String name,
java.lang.Class<T> enumClass,
T defaultValue,
boolean ignoreCase)
throws JSONRPC2Error
name - The parameter name.enumClass - An enumeration type with constant names representing
the acceptable string values.defaultValue - The default return value if the parameter
doesn't exist. May be null.ignoreCase - If true a case insensitive match against
the acceptable constant names is performed.
JSONRPC2Error - On a bad type or bad enumeration value
(JSONRPC2Error.INVALID_PARAMS).
public boolean getBoolean(java.lang.String name)
throws JSONRPC2Error
name - The parameter name.
boolean.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public boolean getOptBoolean(java.lang.String name,
boolean defaultValue)
throws JSONRPC2Error
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist.
boolean.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public int getInt(java.lang.String name)
throws JSONRPC2Error
int.
name - The parameter name.
int.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public int getOptInt(java.lang.String name,
int defaultValue)
throws JSONRPC2Error
int.
If it doesn't exist the method will return the specified default
value.
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist.
int.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public long getLong(java.lang.String name)
throws JSONRPC2Error
long.
name - The parameter name.
long.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public long getOptLong(java.lang.String name,
long defaultValue)
throws JSONRPC2Error
long.
If it doesn't exist the method will return the specified default
value.
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public float getFloat(java.lang.String name)
throws JSONRPC2Error
float.
name - The parameter name.
float.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public float getOptFloat(java.lang.String name,
float defaultValue)
throws JSONRPC2Error
float. If it doesn't exist the method will return the
specified default value.
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist.
float.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public double getDouble(java.lang.String name)
throws JSONRPC2Error
double.
name - The parameter name.
double.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public double getOptDouble(java.lang.String name,
double defaultValue)
throws JSONRPC2Error
double. If it doesn't exist the method will return the
specified default value.
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist.
double.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public java.util.List<java.lang.Object> getList(java.lang.String name)
throws JSONRPC2Error
name - The parameter name.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public java.util.List<java.lang.Object> getList(java.lang.String name,
boolean allowNull)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public java.util.List<java.lang.Object> getOptList(java.lang.String name,
java.util.List<java.lang.Object> defaultValue)
throws JSONRPC2Error
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public java.util.List<java.lang.Object> getOptList(java.lang.String name,
boolean allowNull,
java.util.List<java.lang.Object> defaultValue)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String[] getStringArray(java.lang.String name)
throws JSONRPC2Error
name - The parameter name.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String[] getStringArray(java.lang.String name,
boolean allowNull)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String[] getOptStringArray(java.lang.String name,
java.lang.String[] defaultValue)
throws JSONRPC2Error
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public java.lang.String[] getOptStringArray(java.lang.String name,
boolean allowNull,
java.lang.String[] defaultValue)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.defaultValue - The default return value if the parameter
doesn't exist.
JSONRPC2Error - On a bad parameter type
(JSONRPC2Error.INVALID_PARAMS).
public java.util.Map<java.lang.String,java.lang.Object> getMap(java.lang.String name)
throws JSONRPC2Error
name - The parameter name.
JSONRPC2Error - On a missing parameter, bad type or
null value
(JSONRPC2Error.INVALID_PARAMS).
public java.util.Map<java.lang.String,java.lang.Object> getMap(java.lang.String name,
boolean allowNull)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.
JSONRPC2Error - On a missing parameter or bad type
(JSONRPC2Error.INVALID_PARAMS).
public java.util.Map<java.lang.String,java.lang.Object> getOptMap(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> defaultValue)
throws JSONRPC2Error
name - The parameter name.defaultValue - The default return value if the parameter
doesn't exist. May be null.
JSONRPC2Error - On a bad parameter type or null value
(JSONRPC2Error.INVALID_PARAMS).
public java.util.Map<java.lang.String,java.lang.Object> getOptMap(java.lang.String name,
boolean allowNull,
java.util.Map<java.lang.String,java.lang.Object> defaultValue)
throws JSONRPC2Error
name - The parameter name.allowNull - If true allows a null value.defaultValue - The default return value if the parameter
doesn't exist.
JSONRPC2Error - On a bad parameter type
(JSONRPC2Error.INVALID_PARAMS).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||