org.freedesktop.dbus

Class Variant<T>

public class Variant<T> extends 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.
Constructor Summary
Variant(T o)
Create a Variant from a basic type object.
Variant(T o, Type type)
Create a Variant.
Variant(T o, String sig)
Create a Variant.
Method Summary
booleanequals(Object other)
Compare this Variant with another by comparing contents
StringgetSig()
Return the dbus signature of the wrapped value.
TypegetType()
Return the type of the wrapped value.
TgetValue()
Return the wrapped value.
StringtoString()
Format the Variant as a string.

Constructor Detail

Variant

public Variant(T o)
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.

Variant

public Variant(T o, Type type)
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.

Variant

public Variant(T o, String sig)
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.

Method Detail

equals

public boolean equals(Object other)
Compare this Variant with another by comparing contents

getSig

public String getSig()
Return the dbus signature of the wrapped value.

getType

public Type getType()
Return the type of the wrapped value.

getValue

public T getValue()
Return the wrapped value.

toString

public String toString()
Format the Variant as a string.