This is an experimental parser and generator that creates Java bindings sources from GObject Introspection .gir XML files. XOM is used for parsing the XMLs. The generated Java code is built and exported using CodeModel. The native interoperability library used is BridJ.
Currently, gir2java is capable of:
- generating enums for enumeration elements found in .girs
- using
<package>elements to generate package names - creating empty interfaces for opaque structs
- creating classes for
<record>and<class>elements with fields - tracking types defined in the .gir files, and resolving references to them
- handling array types to some degree
- reading a static mappings list
- keeping a diagnostic list of referenced, and defined types, and their difference to help identify any external dependencies
- parsing the given files in topologically sorted order based on includes, which means the parser should see type definitions before references to them
While it currently seems that a modern system provides enough information in .gir files to generate a GStreamer bindings set from them down to GLib primitive types, a previous effort was made to generate low-level GLib/GObject bindings using a different approach at gstreamer-1.x-java. This is because GObject and below were expected to be special and not able to be generated from .gir files, especially following a discussion on gir-devel-list.
The repository contains an Eclipse (3.8.1) project that you can import straight to your workspace. There is no build file yet, just run the Gir2Java class from Eclipse. It will print information about correct usage.