java.lang.Object
com.thetransactioncompany.jsonrpc2.util.ParamsRetriever
- Direct Known Subclasses:
NamedParamsRetriever, PositionalParamsRetriever
The base abstract class for the JSON-RPC 2.0 parameter retrievers.
Constructor Summary
ConstructorsConstructorDescriptionConstructor for subclasses; a retriever holds no state of its own.Method Summary
Modifier and TypeMethodDescriptionprotected static <T extends Enum<T>>
TgetEnumStringMatch(String input, Class<T> enumClass, boolean ignoreCase) Matches a string against an enumeration of acceptable values.protected static StringgetEnumStringMatch(String input, String[] enumStrings, boolean ignoreCase) Matches a string against an array of acceptable values.abstract intsize()Returns the parameter count.
Constructor Details
ParamsRetriever
public ParamsRetriever()Constructor for subclasses; a retriever holds no state of its own.
Method Details
size
public abstract int size()Returns the parameter count.- Returns:
- The parameters count.
getEnumStringMatch
Matches a string against an array of acceptable values.- Parameters:
input- The string to match.enumStrings- The acceptable string values. Must not benull.ignoreCase-truefor a case insensitive match.- Returns:
- The matching string value,
nullif no match was found.
getEnumStringMatch
protected static <T extends Enum<T>> T getEnumStringMatch(String input, Class<T> enumClass, boolean ignoreCase) Matches a string against an enumeration of acceptable values.- Type Parameters:
T- the element type of enumClass, whose constants are compared against input- Parameters:
input- The string to match.enumClass- The enumeration class specifying the acceptableignoreCase-truefor a case insensitive match.- Returns:
- The matching enumeration constant,
nullif no match was found.