AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry| Modifier and Type | Field and Description |
|---|---|
static String |
MTYPE_KEY
Key for message MType.
|
static String |
PARAMS_KEY
Key for map of parameters used by this message.
|
| Constructor and Description |
|---|
Message()
Constructs an empty message.
|
Message(Map map)
Constructs a message based on an existing map.
|
Message(String mtype)
Constructs a message with a given MType.
|
Message(String mtype,
Map params)
Constructs a message with a given MType and params map.
|
| Modifier and Type | Method and Description |
|---|---|
Message |
addParam(String name,
Object value)
Sets the value for a single entry in this message's
samp.params map. |
static Message |
asMessage(Map map)
Returns a given map as a Message object.
|
void |
check()
Checks that this object is ready for use with the SAMP toolkit.
|
String |
getMType()
Returns this message's MType.
|
Object |
getParam(String name)
Returns the value of a single entry in this message's
samp.params map. |
Map |
getParams()
Returns this message's params map.
|
Object |
getRequiredParam(String name)
Returns the value of a single entry in this message's
samp.params map, throwing an exception
if it is not present. |
void |
setParams(Map params)
Sets this message's params map.
|
checkHasKeys, entrySet, getList, getMap, getString, getUrl, putclear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic static final String MTYPE_KEY
public static final String PARAMS_KEY
public Message()
public Message(Map map)
map - map containing initial data for this objectpublic Message(String mtype, Map params)
mtype - value for MTYPE_KEY keyparams - value for PARAMS_KEY keypublic void setParams(Map params)
params - value for PARAMS_KEYpublic Map getParams()
PARAMS_KEYpublic Message addParam(String name, Object value)
samp.params map.name - param namevalue - param valuepublic Object getParam(String name)
samp.params map. Null is returned if the parameter
does not appear.name - param namepublic Object getRequiredParam(String name)
samp.params map, throwing an exception
if it is not present.name - param nameDataException - if no parameter name is presentpublic void check()
SampMapSampUtils.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 informative DataException will be thrown.Copyright © 2008–2024. All rights reserved.