Release 4.7 New Infrastructure for Automatic API Generation
This release addresses two major issues in the underlying infrastructure of HtmlFlow:
-
Unified API Generators: Combines two previously separate API generators—one for Java and another for idiomatic Kotlin builders using function literals with receivers—into a single unified infrastructure.
-
Simplified Manual Integration: Streamlines the process of merging manually written builders (e.g.,
of()
,dynamic()
,async()
,suspending()
, etc.) with automatically generated HTML builders.
Initially, when we introduced an alternative Kotlin API alongside the existing
Java API, the automatic Kotlin generation mechanism was not integrated into the
existing HtmlApiFaster
infrastructure. Instead, as an experimental approach,
we integrated it directly within the HtmlFlow module using KotlinPoet to
generate Kotlin source code. This was a departure from the previous approach,
which relied on ASM (a Java bytecode manipulation library) to generate the
element classes that make up the HtmlFlow Java API.
Additionally, extending the autogenerated Element
base interface to include
new dynamic features was cumbersome. The legacy process required manually
merging custom additions after running the automatic generation.
With the introduction of the new xsd2poet
dependency, which replaces the
legacy XsdAsmFaster
and HtmlApiFaster
, we now generate source code instead
of bytecode. Furthermore, we have refactored the backbone of the
org.xmlet.htmlapifaster
API to be maintained as source code rather than
dynamically generated classes.
This new approach significantly simplifies the maintenance and enhancement of HtmlFlow’s custom features.