Package org.freedesktop.dbus
Class Variant<T>
- java.lang.Object
-
- org.freedesktop.dbus.Variant<T>
-
public class Variant<T> extends java.lang.Object
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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Compare this Variant with another by comparing contentsjava.lang.String
getSig()
Return the dbus signature of the wrapped value.java.lang.reflect.Type
getType()
Return the type of the wrapped value.T
getValue()
Return the wrapped value.java.lang.String
toString()
Format the Variant as a string.
-
-
-
Constructor Detail
-
Variant
public Variant(T o) throws java.lang.IllegalArgumentException
Create a Variant from a basic type object.- Parameters:
o
- The wrapped value.- Throws:
IllegalArugmentException
- If you try and wrap Null or an object of a non-basic type.java.lang.IllegalArgumentException
-
Variant
public Variant(T o, java.lang.reflect.Type type) throws java.lang.IllegalArgumentException
Create a Variant.- Parameters:
o
- The wrapped value.type
- The explicit type of the value.- Throws:
IllegalArugmentException
- If you try and wrap Null or an object which cannot be sent over DBus.java.lang.IllegalArgumentException
-
Variant
public Variant(T o, java.lang.String sig) throws java.lang.IllegalArgumentException
Create a Variant.- Parameters:
o
- The wrapped value.sig
- The explicit type of the value, as a dbus type string.- Throws:
IllegalArugmentException
- If you try and wrap Null or an object which cannot be sent over DBus.java.lang.IllegalArgumentException
-
-
Method Detail
-
getValue
public T getValue()
Return the wrapped value.
-
getType
public java.lang.reflect.Type getType()
Return the type of the wrapped value.
-
getSig
public java.lang.String getSig()
Return the dbus signature of the wrapped value.
-
toString
public java.lang.String toString()
Format the Variant as a string.- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
Compare this Variant with another by comparing contents- Overrides:
equals
in classjava.lang.Object
-
-