Package com.lucimber.dbus.type
Class DBusDict<KeyT extends DBusBasicType,ValueT extends DBusType>
java.lang.Object
com.lucimber.dbus.type.DBusDict<KeyT,ValueT>
- Type Parameters:
KeyT
- The key's data type.ValueT
- The value's data type.
- All Implemented Interfaces:
DBusContainerType
,DBusType
,Map<KeyT,
ValueT>
public final class DBusDict<KeyT extends DBusBasicType,ValueT extends DBusType>
extends Object
implements Map<KeyT,ValueT>, DBusContainerType
An object that maps keys to values.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) Returns a set view of the mappings contained in this map.entrySet()
static DBusDict<DBusString,
DBusString> fromStringMap
(Map<String, String> map) Creates a dictionary with string keys and string values from a Java Map.static DBusDict<DBusString,
DBusVariant> fromVariantMap
(Map<String, Object> map) Creates a dictionary with string keys and variant values from a Java Map.Gets the wrapped value of this container type.Gets the signature of this container type.getType()
Gets the type of this implementation.boolean
isEmpty()
keySet()
static DBusDict<DBusInt32,
DBusString> Creates a dictionary with int32 keys and string values.static DBusDict<DBusObjectPath,
DBusString> Creates a dictionary with object path keys and string values.static DBusDict<DBusString,
DBusBoolean> Creates a dictionary with string keys and boolean values.static DBusDict<DBusString,
DBusInt32> Creates a dictionary with string keys and int32 values.static DBusDict<DBusString,
DBusInt64> Creates a dictionary with string keys and int64 values.static DBusDict<DBusString,
DBusString> Creates a dictionary with string keys and string values.static DBusDict<DBusString,
DBusVariant> Creates a dictionary with string keys and variant values.void
int
size()
toString()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
DBusDict
Constructs a new instance.- Parameters:
signature
- aDBusSignature
; must describe a dictionary
-
DBusDict
Constructs a new instance from another.- Parameters:
other
- aDBusDict
-
-
Method Details
-
ofStringToString
Creates a dictionary with string keys and string values.- Returns:
- a new empty DBusDict with string keys and values
-
ofStringToVariant
Creates a dictionary with string keys and variant values.- Returns:
- a new empty DBusDict with string keys and variant values
-
ofStringToInt32
Creates a dictionary with string keys and int32 values.- Returns:
- a new empty DBusDict with string keys and int32 values
-
ofStringToInt64
Creates a dictionary with string keys and int64 values.- Returns:
- a new empty DBusDict with string keys and int64 values
-
ofStringToBoolean
Creates a dictionary with string keys and boolean values.- Returns:
- a new empty DBusDict with string keys and boolean values
-
ofInt32ToString
Creates a dictionary with int32 keys and string values.- Returns:
- a new empty DBusDict with int32 keys and string values
-
ofObjectPathToString
Creates a dictionary with object path keys and string values.- Returns:
- a new empty DBusDict with object path keys and string values
-
fromStringMap
Creates a dictionary with string keys and string values from a Java Map.- Parameters:
map
- the Java map to convert- Returns:
- a new DBusDict containing the map entries
-
fromVariantMap
Creates a dictionary with string keys and variant values from a Java Map.- Parameters:
map
- the Java map to convert- Returns:
- a new DBusDict containing the map entries as variants
-
getSignature
Description copied from interface:DBusContainerType
Gets the signature of this container type. The returned signature describes the container and its content.- Specified by:
getSignature
in interfaceDBusContainerType
- Returns:
- a
DBusSignature
-
getType
Description copied from interface:DBusType
Gets the type of this implementation. -
getDelegate
Description copied from interface:DBusContainerType
Gets the wrapped value of this container type. The D-Bus type system is made of ASCII characters representing the value's type. Each D-Bus data type is mapped in this framework by its corresponding class. This method enables the access to the Java's data type - the delegate. If this container is for example aDBusArray
, the returned object will be aList
.- Specified by:
getDelegate
in interfaceDBusContainerType
- Returns:
- an
Object
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<KeyT extends DBusBasicType,
ValueT extends DBusType>
-
containsValue
- Specified by:
containsValue
in interfaceMap<KeyT extends DBusBasicType,
ValueT extends DBusType>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
dictionaryEntrySet
Returns a set view of the mappings contained in this map.- Returns:
- a set
-
toString
-