Class VariantTypes

java.lang.Object
org.javagi.glib.types.VariantTypes

@NullMarked public class VariantTypes extends Object
This class contains G_VARIANT_TYPE_... declarations and conversion functions from Java classes to GVariant types and vice versa.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final VariantType
    An indefinite type that is a supertype of every type (including itself).
    static final VariantType
    An indefinite type that is a supertype of every array type.
    static final VariantType
    An indefinite type that is a supertype of every basic (ie: non-container) type.
    static final VariantType
    The type of a value that can be either true or false.
    static final VariantType
    The type of an integer value that can range from 0 to 255.
    static final VariantType
    The type of an array of bytes.
    static final VariantType
    The type of an array of byte strings (an array of arrays of bytes).
    static final VariantType
    An indefinite type that is a supertype of every dictionary entry type.
    static final VariantType
    An indefinite type that is a supertype of every dictionary type -- that is, any array type that has an element type equal to any dictionary entry type.
    static final VariantType
    The type of a double precision IEEE754 floating point number.
    static final VariantType
    The type of a 32bit signed integer value, that by convention, is used as an index into an array of file descriptors that are sent alongside a D-Bus message.
    static final VariantType
    The type of an integer value that can range from -32768 to 32767.
    static final VariantType
    The type of an integer value that can range from -2147483648 to 2147483647.
    static final VariantType
    The type of an integer value that can range from -9223372036854775808 to 9223372036854775807.
    static final VariantType
    An indefinite type that is a supertype of every maybe type.
    static final VariantType
    The type of a D-Bus object reference.
    static final VariantType
    The type of an array of object paths.
    static final VariantType
    The type of a D-Bus type signature.
    static final VariantType
    The type of a string.
    static final VariantType
    The type of an array of strings.
    static final VariantType
    An indefinite type that is a supertype of every tuple type, regardless of the number of items in the tuple.
    static final VariantType
    The type of an integer value that can range from 0 to 65535.
    static final VariantType
    The type of an integer value that can range from 0 to 4294967295.
    static final VariantType
    The type of an integer value that can range from 0 to 18446744073709551615 (inclusive).
    static final VariantType
    The empty tuple type.
    static final VariantType
    The type of a dictionary mapping strings to variants (the ubiquitous "a{sv}" type).
    static final VariantType
    The type of a box that contains any other value (including another variant).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable VariantType
    objectToVariantType(@Nullable Object object)
    Return a VariantType that is suitable for the Java class of this object.
    static @Nullable Class<?>
    variantToClass(@Nullable Variant variant)
    Return a Java class that is suitable for the VariantType of this GVariant.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BOOLEAN

      public static final VariantType BOOLEAN
      The type of a value that can be either true or false.
    • BYTE

      public static final VariantType BYTE
      The type of an integer value that can range from 0 to 255.
    • INT16

      public static final VariantType INT16
      The type of an integer value that can range from -32768 to 32767.
    • UINT16

      public static final VariantType UINT16
      The type of an integer value that can range from 0 to 65535. There were about this many people living in Toronto in the 1870s.
    • INT32

      public static final VariantType INT32
      The type of an integer value that can range from -2147483648 to 2147483647.
    • UINT32

      public static final VariantType UINT32
      The type of an integer value that can range from 0 to 4294967295. That's one number for everyone who was around in the late 1970s.
    • INT64

      public static final VariantType INT64
      The type of an integer value that can range from -9223372036854775808 to 9223372036854775807.
    • UINT64

      public static final VariantType UINT64
      The type of an integer value that can range from 0 to 18446744073709551615 (inclusive). That's a really big number, but a Rubik's cube can have a bit more than twice as many possible positions.
    • DOUBLE

      public static final VariantType DOUBLE
      The type of a double precision IEEE754 floating point number. These guys go up to about 1.80e308 (plus and minus) but miss out on some numbers in between. In any case, that's far greater than the estimated number of fundamental particles in the observable universe.
    • STRING

      public static final VariantType STRING
      The type of a string. "" is a string. null is not a string.
    • OBJECT_PATH

      public static final VariantType OBJECT_PATH
      The type of a D-Bus object reference. These are strings of a specific format used to identify objects at a given destination on the bus.

      If you are not interacting with D-Bus, then there is no reason to make use of this type. If you are, then the D-Bus specification contains a precise description of valid object paths.

    • SIGNATURE

      public static final VariantType SIGNATURE
      The type of a D-Bus type signature. These are strings of a specific format used as type signatures for D-Bus methods and messages.

      If you are not interacting with D-Bus, then there is no reason to make use of this type. If you are, then the D-Bus specification contains a precise description of valid signature strings.

    • VARIANT

      public static final VariantType VARIANT
      The type of a box that contains any other value (including another variant).
    • HANDLE

      public static final VariantType HANDLE
      The type of a 32bit signed integer value, that by convention, is used as an index into an array of file descriptors that are sent alongside a D-Bus message.

      If you are not interacting with D-Bus, then there is no reason to make use of this type.

    • UNIT

      public static final VariantType UNIT
      The empty tuple type. Has only one instance. Known also as "triv" or "void".
    • ANY

      public static final VariantType ANY
      An indefinite type that is a supertype of every type (including itself).
    • BASIC

      public static final VariantType BASIC
      An indefinite type that is a supertype of every basic (ie: non-container) type.
    • MAYBE

      public static final VariantType MAYBE
      An indefinite type that is a supertype of every maybe type.
    • ARRAY

      public static final VariantType ARRAY
      An indefinite type that is a supertype of every array type.
    • TUPLE

      public static final VariantType TUPLE
      An indefinite type that is a supertype of every tuple type, regardless of the number of items in the tuple.
    • DICT_ENTRY

      public static final VariantType DICT_ENTRY
      An indefinite type that is a supertype of every dictionary entry type.
    • DICTIONARY

      public static final VariantType DICTIONARY
      An indefinite type that is a supertype of every dictionary type -- that is, any array type that has an element type equal to any dictionary entry type.
    • STRING_ARRAY

      public static final VariantType STRING_ARRAY
      The type of an array of strings.
    • OBJECT_PATH_ARRAY

      public static final VariantType OBJECT_PATH_ARRAY
      The type of an array of object paths.
    • BYTESTRING

      public static final VariantType BYTESTRING
      The type of an array of bytes. This type is commonly used to pass around strings that may not be valid utf8. In that case, the convention is that the nul terminator character should be included as the last character in the array.
    • BYTESTRING_ARRAY

      public static final VariantType BYTESTRING_ARRAY
      The type of an array of byte strings (an array of arrays of bytes).
    • VARDICT

      public static final VariantType VARDICT
      The type of a dictionary mapping strings to variants (the ubiquitous "a{sv}" type).
      Since:
      2.30
  • Constructor Details

    • VariantTypes

      public VariantTypes()
  • Method Details

    • objectToVariantType

      public static @Nullable VariantType objectToVariantType(@Nullable Object object)
      Return a VariantType that is suitable for the Java class of this object.
      Parameters:
      object - a Java object instance
      Returns:
      the VariantType
    • variantToClass

      public static @Nullable Class<?> variantToClass(@Nullable Variant variant)
      Return a Java class that is suitable for the VariantType of this GVariant.
      Parameters:
      variant - a Variant instance
      Returns:
      the Java class