Summary
The databind module contains pre-generated binding classes in gov.nist.secauto.metaschema.databind.model.metaschema.binding that have been heavily modified with:
- Custom interface implementations
- Extended base classes
- Additional helper methods
These modifications are defined in the binding configuration (databind-metaschema/src/main/metaschema-bindings/metaschema-metaschema-bindings.xml) but the current code generator doesn't fully support regenerating these classes with all customizations intact.
Current State
- Binding classes are pre-generated and checked into
src/main/java
- Manual modifications have been applied post-generation
- No automated way to regenerate while preserving customizations
- Collection properties use hardcoded implementation classes (
LinkedList, LinkedHashMap)
Proposed Solution
Extend the metaschema-maven-plugin code generator to support:
1. Interface and Base Class Configuration
<implement-interface> - Add interface implementations to generated classes
<extend-base-class> - Specify custom base classes
2. Collection Implementation Override
Support overriding the default collection implementation class for collection-typed properties via binding configuration:
<define-assembly name="test-suite">
<define-field name="test-collections">
<collection-class>java.util.ArrayList</collection-class>
</define-field>
</define-assembly>
This allows:
ArrayList instead of LinkedList for better random access performance
TreeMap instead of LinkedHashMap for sorted key ordering
- Custom collection implementations for specialized use cases
The generator should:
- Parse the
<collection-class> element from binding configuration
- Pass the override to
getCollectionImplementationClass() in the type info
- Fall back to current defaults (
LinkedList/LinkedHashMap) when not specified
- Validate that the specified class is compatible with the collection type (List vs Map)
Acceptance Criteria
Related
Summary
The
databindmodule contains pre-generated binding classes ingov.nist.secauto.metaschema.databind.model.metaschema.bindingthat have been heavily modified with:These modifications are defined in the binding configuration (
databind-metaschema/src/main/metaschema-bindings/metaschema-metaschema-bindings.xml) but the current code generator doesn't fully support regenerating these classes with all customizations intact.Current State
src/main/javaLinkedList,LinkedHashMap)Proposed Solution
Extend the metaschema-maven-plugin code generator to support:
1. Interface and Base Class Configuration
<implement-interface>- Add interface implementations to generated classes<extend-base-class>- Specify custom base classes2. Collection Implementation Override
Support overriding the default collection implementation class for collection-typed properties via binding configuration:
This allows:
ArrayListinstead ofLinkedListfor better random access performanceTreeMapinstead ofLinkedHashMapfor sorted key orderingThe generator should:
<collection-class>element from binding configurationgetCollectionImplementationClass()in the type infoLinkedList/LinkedHashMap) when not specifiedAcceptance Criteria
implement-interfacebinding configurationextend-base-classbinding configurationcollection-classbinding configuration for collection propertiespom-bootstrap.xmlfor databind moduleRelated
metaschema-testing/pom-bootstrap.xmlfor bootstrap pattern example