hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

InterfaceCodeGenerator - extended to generate DBusProperty annotations #132

Closed mk868 closed 3 years ago

mk868 commented 3 years ago

Following the new @DBusProperty annotation I extended the functionality of the InterfaceCodeGenerator tool. The tool now recognizes the input <property tag and translates it into a corresponding @DBusProperty annotation.

I tested it with the input xml:

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
 <interface name="com.example.Foo">
  <method name="method1" >
   <arg type="s" direction="out"/>
   <arg type="s" direction="in"/>
  </method>
 </interface>
 <interface name="com.example.Bar">
  <method name="method2" >
   <arg type="i" direction="in"/>
   <arg type="s" direction="out"/>
  </method>
  <property name="SimpleList1" type="av" access="read" />
  <property name="SimpleMap" type="a{vv}" access="read" />
  <property name="ComplexMap" type="a{sas}" access="readwrite" />
  <property name="Double" type="d" access="write" />
  <property name="DefaultType" type="v" access="write" />
  <property name="IISX" type="(iisx)" access="write" />
  <property name="ListOfISX" type="a(isx)" access="write" />
  <property name="Path" type="o" access="readwrite" />
  <property name="Bool" type="b" access="readwrite" />
  <property name="String2" type="s" access="readwrite" />
 </interface>
</node>

Of course the output file still needs some manual corrections such as removing unnecessary empty lines.