Package org.astrogrid.samp.web
Class Callback
- java.lang.Object
-
- java.util.AbstractMap
-
- org.astrogrid.samp.SampMap
-
- org.astrogrid.samp.web.Callback
-
- All Implemented Interfaces:
java.util.Map
class Callback extends SampMap
Map representing a client callback from the hub. It normally contains a callback method name and a list of parameters. An instance of this class can be used to correspond to one of the calls in theCallableClient
interface.- Since:
- 2 Feb 2011
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]
KNOWN_KEYS
static java.lang.String
METHODNAME_KEY
Key for the callback method name (a string).static java.lang.String
PARAMS_KEY
Key for the callback parameters (a list).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Callback
asCallback(java.util.Map map)
Returns a given map as a Callback object.void
check()
Checks that this object is ready for use with the SAMP toolkit.java.lang.String
getMethodName()
Returns the method name.java.util.List
getParams()
Returns the parameter list.void
setMethodName(java.lang.String methodName)
Sets the method name.void
setParams(java.util.List params)
Sets the parameter list.-
Methods inherited from class org.astrogrid.samp.SampMap
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
-
-
-
-
Field Detail
-
METHODNAME_KEY
public static final java.lang.String METHODNAME_KEY
Key for the callback method name (a string).- See Also:
- Constant Field Values
-
PARAMS_KEY
public static final java.lang.String PARAMS_KEY
Key for the callback parameters (a list).- See Also:
- Constant Field Values
-
KNOWN_KEYS
private static final java.lang.String[] KNOWN_KEYS
-
-
Constructor Detail
-
Callback
public Callback()
Constructs an empty callback.
-
Callback
public Callback(java.util.Map map)
Constructs a callback based on an existing map.- Parameters:
map
- contents
-
Callback
public Callback(java.lang.String methodName, java.util.List params)
Constructs a callback given a method name and parameter list.
-
-
Method Detail
-
setMethodName
public void setMethodName(java.lang.String methodName)
Sets the method name.- Parameters:
methodName
- method name
-
getMethodName
public java.lang.String getMethodName()
Returns the method name.- Returns:
- method name
-
setParams
public void setParams(java.util.List params)
Sets the parameter list.- Parameters:
params
- parameter list
-
getParams
public java.util.List getParams()
Returns the parameter list.- Returns:
- parameter list
-
check
public void check()
Description copied from class:SampMap
Checks that this object is ready for use with the SAMP toolkit. As well as callingSampUtils.checkMap(java.util.Map)
(ensuring that all keys are Strings, and all values Strings, Lists or Maps), subclass-specific invariants may be checked. In the case that there's something wrong, an informativeDataException
will be thrown.
-
asCallback
public static Callback asCallback(java.util.Map map)
Returns a given map as a Callback object.- Parameters:
map
- map- Returns:
- callback
-
-