Package com.lucimber.dbus.type
Class DBusSignature
java.lang.Object
com.lucimber.dbus.type.DBusSignature
- All Implemented Interfaces:
DBusBasicType
,DBusType
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 Summary
Modifier and TypeMethodDescriptionboolean
Gets a list of signatures that are a subset of this signature.Gets the wrapped value of this basic type.int
Gets the number of single complete types of which this signature consists of.getType()
Gets the type of this implementation.int
hashCode()
boolean
isArray()
ReturnsTRUE
, if this signature describes an array andFALSE
otherwise.boolean
ReturnsTRUE
, if this signature describes a container andFALSE
otherwise.boolean
ReturnsTRUE
, if this signature describes a dictionary andFALSE
otherwise.boolean
ReturnsTRUE
, if this signature describes a dictionary-entry andFALSE
otherwise.boolean
isStruct()
ReturnsTRUE
, if this signature describes a struct andFALSE
otherwise.boolean
ReturnsTRUE
, if this signature describes a variant andFALSE
otherwise.Returns a new signature without the enclosing container description.toString()
static DBusSignature
valueOf
(CharSequence sequence) Constructs a newDBusSignature
instance by parsing aCharSequence
.
-
Method Details
-
valueOf
Constructs a newDBusSignature
instance by parsing aCharSequence
.- Parameters:
sequence
- The sequence composed of one or multiple single complete types.- Returns:
- A new instance of
DBusSignature
. - Throws:
SignatureException
- If the givenCharSequence
is not well-formed.
-
getChildren
Gets a list of signatures that are a subset of this signature. Each signature describes a single complete type.- Returns:
- a
List
ofDBusSignature
s
-
getQuantity
public int getQuantity()Gets the number of single complete types of which this signature consists of.- Returns:
- an
Integer
-
toString
-
getType
Description copied from interface:DBusType
Gets the type of this implementation. -
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 aDBusBoolean
, the returned object will be aBoolean
.- Specified by:
getDelegate
in interfaceDBusBasicType
- Returns:
- an
Object
-
equals
-
hashCode
public int hashCode() -
isDictionary
public boolean isDictionary()ReturnsTRUE
, if this signature describes a dictionary andFALSE
otherwise. A dictionary is an array of dict-entries.- Returns:
- a
Boolean
-
isArray
public boolean isArray()ReturnsTRUE
, if this signature describes an array andFALSE
otherwise.- Returns:
- a
Boolean
-
isDictionaryEntry
public boolean isDictionaryEntry()ReturnsTRUE
, if this signature describes a dictionary-entry andFALSE
otherwise. A dictionary-entry is a key-value pair.- Returns:
- a
Boolean
-
isStruct
public boolean isStruct()ReturnsTRUE
, if this signature describes a struct andFALSE
otherwise.- Returns:
- a
Boolean
-
isVariant
public boolean isVariant()ReturnsTRUE
, if this signature describes a variant andFALSE
otherwise.- Returns:
- a
Boolean
-
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()ReturnsTRUE
, if this signature describes a container andFALSE
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.
-