java.lang.Object
org.freedesktop.dbus.types.Variant<T>
A Wrapper class for Variant values.
A method on DBus can send or receive a Variant.
This will wrap another value whose type is determined at runtime.
The Variant may be parameterized to restrict the types it may accept.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a Variant from a basic type object.Create a Variant.Create a Variant.
It is expected that the given value is compatible with the provided DBus signature String.
This constructor is intended to be used when a generic using class/interface should be wrapped.
Map or List are two examples where it is not possible to determine the internal data type (the type represented by a generic placeholder) due to type erasure.
Therefore the only way to properly serialize these Maps/Lists is by providing a suitable signature manually. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompare this Variant with another by comparing contents.getSig()Return the dbus signature of the wrapped value.getType()Return the type of the wrapped value.getValue()Return the wrapped value.inthashCode()toString()Format the Variant as a string.
-
Constructor Details
-
Variant
Create a Variant from a basic type object.- Parameters:
_value- The wrapped value.- Throws:
IllegalArgumentException- If you try and wrap Null or an object of a non-basic type.
-
Variant
Create a Variant.- Parameters:
_value- The wrapped value._type- The explicit type of the value.- Throws:
IllegalArgumentException- If you try and wrap Null or an object which cannot be sent over DBus.
-
Variant
Create a Variant.
It is expected that the given value is compatible with the provided DBus signature String.
This constructor is intended to be used when a generic using class/interface should be wrapped.
Map or List are two examples where it is not possible to determine the internal data type (the type represented by a generic placeholder) due to type erasure.
Therefore the only way to properly serialize these Maps/Lists is by providing a suitable signature manually.- Parameters:
_value- The wrapped value._sig- The explicit type of the value, as a dbus type string.- Throws:
IllegalArgumentException- If you try and wrap Null or an object which cannot be sent over DBus.
-
-
Method Details
-
getValue
Return the wrapped value.- Returns:
- value
-
getType
Return the type of the wrapped value.- Returns:
- type
-
getSig
Return the dbus signature of the wrapped value.- Returns:
- signature
-
toString
Format the Variant as a string. -
hashCode
public int hashCode() -
equals
Compare this Variant with another by comparing contents.
-