com.thetransactioncompany.jsonrpc2.util
Class ParamsRetriever

java.lang.Object
  extended by com.thetransactioncompany.jsonrpc2.util.ParamsRetriever
Direct Known Subclasses:
NamedParamsRetriever, PositionalParamsRetriever

public abstract class ParamsRetriever
extends java.lang.Object

Base abstract class for the JSON-RPC 2.0 parameter retrievers.

Version:
1.9.1 (2010-03-15)
Author:
Vladimir Dzhuvinov

Constructor Summary
ParamsRetriever()
           
 
Method Summary
protected static void ensureEnumString(java.lang.String input, java.lang.String[] enumStrings, boolean ignoreCase)
          Throws a JSONRPC2Error.INVALID_PARAMS exception if there the specified string doesn't match the enumeration.
abstract  int size()
          Returns the parameter count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParamsRetriever

public ParamsRetriever()
Method Detail

size

public abstract int size()
Returns the parameter count.

Returns:
The number of parameters.

ensureEnumString

protected static void ensureEnumString(java.lang.String input,
                                       java.lang.String[] enumStrings,
                                       boolean ignoreCase)
                                throws JSONRPC2Error
Throws a JSONRPC2Error.INVALID_PARAMS exception if there the specified string doesn't match the enumeration. You can also specify whether to match the string case exactly.

You may use this method to fire the proper JSON-RPC 2.0 error on an invalid enumerated string parameter.

Parameters:
input - The string to check.
enumStrings - The possible string values.
ignoreCase - Specifies if the case of the checked string must match the case of the expected strings.
Throws:
JSONRPC2Error - With proper code and message if the input string is unexpected.


Copyright © 2009-2010 Vladimir Dzhuvinov. All Rights Reserved.