Generates corresponding Java model classes out of Java parser classes as they are generated by Kaitai Struct.
This is to allow not having to continue working with the Kaitai Struct-generated parsers after the parsing has been completed. Thus, the model of some format can be specified only once through the .ksy files and, afterwards, the from the parser detached, pure Java model classes can serve as an interface and easily be auto-mapped with model mappers and serialized.
The Extractor tool currently works via Java Reflection, so the parser classes have to be compiled to .class files in order to load and inspect them on runtime (and they are read from the file system). Maybe later support can be added for taking Java source files.
For writing, the tool uses JavaPoet.
The command line interface is done with picoli.
gradle jar
java -jar .\build\libs\kaitai_struct_model_extractor-0.1.0.jar --inputDir <inputDir> --outputDir <outputDir> -ipkg <inputPackageName> -opkg <outputPackageName>
The package names will be automatically added to the input and output paths when searching for the files respectively writing them.