Klasse Variant<T>

java.lang.Object
org.freedesktop.dbus.types.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.
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Variant(T _value)
    Create a Variant from a basic type object.
    Variant(T _value, Type _type)
    Create a Variant.
    Variant(T _value, String _sig)
    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.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    equals(Object _obj)
    Compare this Variant with another by comparing contents.
    Return the dbus signature of the wrapped value.
    Return the type of the wrapped value.
    Return the wrapped value.
    int
     
    Format the Variant as a string.

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Konstruktordetails

    • Variant

      public Variant(T _value) throws IllegalArgumentException
      Create a Variant from a basic type object.
      Parameter:
      _value - The wrapped value.
      Löst aus:
      IllegalArgumentException - If you try and wrap Null or an object of a non-basic type.
    • Variant

      public Variant(T _value, Type _type) throws IllegalArgumentException
      Create a Variant.
      Parameter:
      _value - The wrapped value.
      _type - The explicit type of the value.
      Löst aus:
      IllegalArgumentException - If you try and wrap Null or an object which cannot be sent over DBus.
    • Variant

      public Variant(T _value, String _sig) throws IllegalArgumentException
      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.
      Parameter:
      _value - The wrapped value.
      _sig - The explicit type of the value, as a dbus type string.
      Löst aus:
      IllegalArgumentException - If you try and wrap Null or an object which cannot be sent over DBus.
  • Methodendetails

    • getValue

      public T getValue()
      Return the wrapped value.
      Gibt zurück:
      value
    • getType

      public Type getType()
      Return the type of the wrapped value.
      Gibt zurück:
      type
    • getSig

      public String getSig()
      Return the dbus signature of the wrapped value.
      Gibt zurück:
      signature
    • toString

      public String toString()
      Format the Variant as a string.
      Setzt außer Kraft:
      toString in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object _obj)
      Compare this Variant with another by comparing contents.
      Setzt außer Kraft:
      equals in Klasse Object
      Parameter:
      _obj - other object
      Gibt zurück:
      boolean