public abstract class JLJsonCommandHandler
extends java.lang.Object
| Constructor and Description |
|---|
JLJsonCommandHandler() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Double |
checkDoubleParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
Get a double parameter value from input data.
|
boolean |
checkFlagParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required,
boolean dfltVal)
Get a boolean parameter value from input data.
|
java.lang.Integer |
checkIntParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required,
java.lang.Integer dfltVal)
Get an integer parameter value from input data.
|
java.util.Map<java.lang.String,java.lang.Object> |
checkMapParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
Get a map parameter value from the input data; this represents a sub-object within the input object
|
java.lang.Object |
checkParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
Get a parameter value from input data.
|
java.lang.String |
checkStringParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
Get a String parameter value from input data.
|
java.util.List<java.lang.Integer> |
getIntArray(java.lang.String paramName,
java.lang.Object value)
Convert an object to an integer array.
|
static java.util.List<java.lang.String> |
getStringListValue(java.lang.Object str)
Converts a generic object to a java.util.List<String>.
|
abstract java.util.Hashtable<java.lang.String,java.lang.Object> |
handleFunction(java.lang.String sessionId,
java.lang.String function,
java.util.Hashtable<java.lang.String,java.lang.Object> input)
Handle a server request for this family of functions.
|
boolean |
isPattern(java.lang.String pattern)
Check whether a string contains a pattern (wildcard) value.
|
protected JLPoint |
readPoint(java.util.Map<java.lang.String,java.lang.Object> rec)
Convert a generic JSON structure to a JLPoint object
|
protected JLTransform |
readTransform(java.util.Map<java.lang.String,java.lang.Object> rec)
Convert an input JSON structure into a JLTransform object
|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
writeInertia(JLInertia xform)
Convert a JLInertia object to a generic JSON structure
|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
writePoint(JLPoint pt)
Convert a JLPoint object to a generic JSON structure
|
protected java.util.Hashtable<java.lang.String,java.lang.Object> |
writeTransform(JLTransform xform)
Convert a JLTransform object to a generic JSON structure
|
public abstract java.util.Hashtable<java.lang.String,java.lang.Object> handleFunction(java.lang.String sessionId,
java.lang.String function,
java.util.Hashtable<java.lang.String,java.lang.Object> input)
throws JLIException
sessionId - The current session id.function - The name of the function to execute.input - Input parameter data for the function, converted from JSON.JLIExceptionpublic java.lang.Object checkParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
throws JLIException
input - The input data to search.parmname - Name of the parameter.required - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.JLIExceptionpublic java.lang.String checkStringParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
throws JLIException
input - The input data to search.parmname - Name of the parameter.required - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.JLIExceptionpublic boolean checkFlagParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required,
boolean dfltVal)
throws JLIException
input - The input data to search.parmname - Name of the parameter.required - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.dfltVal - Default value for the parameter does not exist and is not required.JLIExceptionpublic java.lang.Integer checkIntParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required,
java.lang.Integer dfltVal)
throws JLIException
input - The input data to search.parmname - Name of the parameter.required - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.dfltVal - Default value for the parameter does not exist and is not required.JLIExceptionpublic java.lang.Double checkDoubleParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
throws JLIException
input - The input data to search.parmname - Name of the parameter.required - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.JLIExceptionpublic java.util.Map<java.lang.String,java.lang.Object> checkMapParameter(java.util.Map<java.lang.String,java.lang.Object> input,
java.lang.String parmname,
boolean required)
throws JLIException
input - The input data to searchparmname - Name of the parameterrequired - Whether the parameter is required; if true, the method will throw an exception if the parameter is missing.JLIExceptionpublic java.util.List<java.lang.Integer> getIntArray(java.lang.String paramName,
java.lang.Object value)
throws JLIException
If the value is a java.util.List, it tries to convert each entry in the list to an Integer and add it to the result. If any entry in the list is not and Integer object, an exception will be thrown.
If the value is a java.lang.String, it assumes the string is a list of numbers separated by spaces and converts each word to an Integer and adds it to the result. If any entry in the string cannot be converted to an Integer object, an exception will be thrown.
paramName - The name of the parameter - used only for error messagesvalue - The object value to convertJLIExceptionpublic static java.util.List<java.lang.String> getStringListValue(java.lang.Object str)
str - The object to convertprotected java.util.Hashtable<java.lang.String,java.lang.Object> writePoint(JLPoint pt)
pt - The JLPoint object to writeprotected JLPoint readPoint(java.util.Map<java.lang.String,java.lang.Object> rec) throws JLIException
rec - The JSON data as a MapJLIExceptionprotected java.util.Hashtable<java.lang.String,java.lang.Object> writeTransform(JLTransform xform)
xform - The JLTransform object to writeprotected JLTransform readTransform(java.util.Map<java.lang.String,java.lang.Object> rec) throws JLIException
rec - The JSON structure as a MapJLIExceptionprotected java.util.Hashtable<java.lang.String,java.lang.Object> writeInertia(JLInertia xform)
xform - The JLInertia object to writepublic boolean isPattern(java.lang.String pattern)
pattern - The pattern to check