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.
See lbt4j, a Linux Bluetooth Library for Java based on BlueZ's D-Bus interfaces.
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 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.
name | value | Description | context |
---|---|---|---|
de.serviceflow.codegenj.CollectorAPI | classname#methodname | Creates 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#*methodname | Creates 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 | |
classname | Modifies 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.ParentAPI | interfacename | Substitutes 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.SkeletonAPI | leave empty | Used to tag interfaces with callbacks | interface |