/codegenj

DBus Code Generator for Java APIs

Primary LanguageJavaApache License 2.0Apache-2.0

codegenj - DBus Code Generator for Java APIs

Build Status Coverage Status Maven Central

About

codegenj is a DBus Code Generator that helps to build Java APIs for DBus interfaces. The tool reads [D-Bus Introspection XML] (https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format) files and generates maven projects. It depends on gdbus-codegen.

EXAMPLES

See lbt4j, a Linux Bluetooth Library for Java based on BlueZ's D-Bus interfaces.

Build

Maven

You can build the jar file and documentation with maven:

mvn clean package site site:run

Open the project documentation in your web browser on http://localhost:9000 or open it without site:run under

target/site/index.html

codegenj's annotations for D-Bus Introspection XML

codegenj defines some new annotations that can be used to improve the API it generates. Some D-Bus types including 'o' are 'ao' are ignored; using this annotation is the only way to make them available.

namevalueDescriptioncontext
de.serviceflow.codegenj.CollectorAPIclassname#methodnameCreates an getter method in the named interface or objectmanager (de.serviceflow.codegenj.ObjectManager) that returns "top-level" interfaces from D-Bus of the type the annotation is placed in and returns a collection of them.interface
classname#*methodnameCreates an getter method in the named interface or objectmanager (de.serviceflow.codegenj.ObjectManager) that queries "current" interfaces from D-Bus of the type the annotation is placed in and returns a collection of them.interface
classnameModifies a property method to cast "child" interfaces to the type given in the value arg.property of access type 'read' with type 'ao'
de.serviceflow.codegenj.ParentAPIinterfacenameSubstitutes a D-Bus call by returning the stored parent object (that should match the type of interfacename in value arg) for the object's path.property of access type 'read' with type 'o'
de.serviceflow.codegenj.SkeletonAPIleave emptyUsed to tag interfaces with callbacksinterface