public class Subscriptions extends SampMap
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry| Constructor and Description |
|---|
Subscriptions()
Constructs an empty subscriptions object.
|
Subscriptions(Map map)
Constructs a subscriptions object based on an existing map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMType(String mtype)
Adds a subscription to a given MType.
|
static Subscriptions |
asSubscriptions(Map map)
Returns a given map in the form of a Subscriptions object.
|
void |
check()
Checks that this object is ready for use with the SAMP toolkit.
|
Map |
getSubscription(String mtype)
Returns the map which forms the value for a given MType key.
|
boolean |
isSubscribed(String mtype)
Determines whether a given (non-wildcarded) MType is subscribed to
by this object.
|
static int |
matchLevel(String pattern,
String mtype)
Performs wildcard matching of MTypes.
|
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 Subscriptions()
public Subscriptions(Map map)
map - map containing initial data for this objectpublic void addMType(String mtype)
mtype may include
a wildcard according to the SAMP rules.mtype - subscribed MType, possibly wildcardedpublic boolean isSubscribed(String mtype)
mtype - MType to testpublic Map getSubscription(String mtype)
mtype, the corresponding value is returned.
If mtype is not subscribed to, null
is returned.mtype - MType to querymtype, or nullpublic 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.public static Subscriptions asSubscriptions(Map map)
map - mappublic static int matchLevel(String pattern, String mtype)
pattern - MType pattern; may contain a wildcardmtype - unwildcarded MType for comparison with
patternpattern which match
mtype; if pattern="*" the result is
0, and if there is no match the result is -1Copyright © 2008–2024. All rights reserved.