Class DBusSignature

java.lang.Object
com.lucimber.dbus.type.DBusSignature
All Implemented Interfaces:
DBusBasicType, DBusType

public final class DBusSignature extends Object implements DBusBasicType
D-Bus uses a string-based type encoding mechanism called Signatures to describe the number and types of arguments required by methods and signals. Signatures are used for interface declaration/documentation, data marshalling, and validity checking. Their string encoding uses a simple, though expressive, format and a basic understanding of it is required for effective D-Bus use.
See Also:
  • Method Details

    • valueOf

      public static DBusSignature valueOf(CharSequence sequence) throws SignatureException
      Constructs a new DBusSignature instance by parsing a CharSequence.
      Parameters:
      sequence - The sequence composed of one or multiple single complete types.
      Returns:
      A new instance of DBusSignature.
      Throws:
      SignatureException - If the given CharSequence is not well-formed.
    • getChildren

      public List<DBusSignature> getChildren()
      Gets a list of signatures that are a subset of this signature. Each signature describes a single complete type.
      Returns:
      a List of DBusSignatures
    • getQuantity

      public int getQuantity()
      Gets the number of single complete types of which this signature consists of.
      Returns:
      an Integer
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getType

      public Type getType()
      Description copied from interface: DBusType
      Gets the type of this implementation.
      Specified by:
      getType in interface DBusType
      Returns:
      a Type
    • getDelegate

      public String getDelegate()
      Description copied from interface: DBusBasicType
      Gets the wrapped value of this basic type. The D-Bus type system is made of ASCII characters representing the value's type. Each D-Bus data type is mapped in this framework by its corresponding class. This method enables the access to the Java's data type - the delegate. If this basic type is for example a DBusBoolean, the returned object will be a Boolean.
      Specified by:
      getDelegate in interface DBusBasicType
      Returns:
      an Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isDictionary

      public boolean isDictionary()
      Returns TRUE, if this signature describes a dictionary and FALSE otherwise. A dictionary is an array of dict-entries.
      Returns:
      a Boolean
    • isArray

      public boolean isArray()
      Returns TRUE, if this signature describes an array and FALSE otherwise.
      Returns:
      a Boolean
    • isDictionaryEntry

      public boolean isDictionaryEntry()
      Returns TRUE, if this signature describes a dictionary-entry and FALSE otherwise. A dictionary-entry is a key-value pair.
      Returns:
      a Boolean
    • isStruct

      public boolean isStruct()
      Returns TRUE, if this signature describes a struct and FALSE otherwise.
      Returns:
      a Boolean
    • isVariant

      public boolean isVariant()
      Returns TRUE, if this signature describes a variant and FALSE otherwise.
      Returns:
      a Boolean
    • subContainer

      public DBusSignature subContainer()
      Returns a new signature without the enclosing container description. The signature must describe an array, a dict-entry or a struct type.
      Returns:
      a DBusSignature
      Throws:
      IllegalArgumentException - If the signature does not describe an array, a dict-entry or a struct type.
    • isContainerType

      public boolean isContainerType()
      Returns TRUE, if this signature describes a container and FALSE otherwise. A container can be an ARRAY, a DICT-ENTRY, a STRUCT or a VARIANT.
      Returns:
      a Boolean
      Throws:
      IllegalArgumentException - If this signature consists of more than one single complete type.