Skip to content

HiSrc BasicJAXB v2.2.1, Explorations

Latest
Compare
Choose a tag to compare
@patrodyne patrodyne released this 10 Apr 15:32
· 66 commits to master since this release

Version 2.2.1 of the HiSrc BasicJAXB project uses JDK 21 for the build but the artifacts produced preserve Java 11 compatibility. Project dependencies and Maven plugins have been updated to current versions.

  • Added FixedValuePlugin to set fixed values from the schema, Issue #15.
  • For FluentApiPlugin:
    • Allow blank fluent method prefix, Issue #19.
    • Provide alternative logic to resolve the field's class name, Issue #20.
    • Added EnforceTypeSafety parameter for mixed type lists.
    • Added OverrideFluentMethods parameter for strong return types.
  • Handle anonymous simple type for DefaultValuePlugin, Issue #21.
  • Support 'otherAttributes' (anyAttribute) in several XJC plugins.

Since version 2.2.0 of the HiSrc BasicJAXB project uses JDK 21 for the build but the artifacts produced preserve Java 11 compatibility. Project dependencies and Maven plugins have been updated to current versions. For assemblies and testing, the HiSrc HigherJAXB Maven plugin has been refactored to eliminate the deprecated maven-compat dependency in favor of the Maven Resolver/Aether dependencies, Issue #17.

Since version 2.1.1 of the HiSrc BasicJAXB project standardizes the XJC plugin option naming/usage, logging and error handling, adds three XJC plugins, adds a sample to bundle its plugins with the XJC tool and updates its Maven plugin and dependency versions.

Three new plugins:

  • The DefaultValuePlugin enables generation of classes that set default values as specified by your XML schema.
  • The FluentApiPlugin enables a Fluent API, method chaining, for your generated code.
  • The ValueConstructor enables generation of constructors to create instances with no or all values.

Also, the InheritancePlugin has been enhanced to add Java annotations to your generated classes, including ObjectFactory, as described by inheritance.xsd. A common use case is to suppress ignorable warnings on ObjectFactory.

A new sample xjc-basic (zip) builds a jar that can be run from the command line: java -jar xjc-basic.jar [options]. That jar reads dependencies from its lib sub-directory including hisrc-basicjaxb-plugins-*.jar. Thus, you can use this tool to generate JAXB classes using the HiSrc BasicJAXB plugins from the command line. This is useful for quick tests, etc.

Since version 2.1.0, the source/target (release) compatibility is at Java 11, up from Java 8. And, JDK 17 is used for the build. JAXB dependencies are at version 4.x for Jakarta EE 10.

To allow for JDK 17 management of reflective access to modularized code, JVM system arguments are now included in the build from src/test/resources/jvmsystem.arguments.

For example, --add-opens java.base/java.net=ALL-UNNAMED, if used, allows all of the code on the class path to access non-public members of public types in the java.base/java.net package.

Since version 2.0.0, the HiSrc BasicJAXB project supports Jakarta EE dependencies. Maintained by the Eclipse Foundation Project, Jakarta EE is the new name for the technology formerly known as Java Enterprise Edition. Within the Jakarta EE dependencies, the package names prefixed by javax have changed to jakarta. In addition, the HiSrc BasicJAXB package name has changed from org.jvnet.jaxb2_commons to org.jvnet.basicjaxb to better reflect the project name. In the same vein, the associated XML Schema namespace has been updated from http://jaxb2-commons.dev.java.net/basic to http://jvnet.org/basicjaxb/xjc.

This release provides ZIP downloads to explore the HiSrc BasicJAXB XJC extensions. Each ZIP exploration is a stand-alone Maven project that uses the HiSrc HigherJAXB Maven Plugin to generate Java classes from an XML schema and configure the HiSrc BasicJAXB library as an XJC plugin. Each exploration (-exNNN-) includes a Swing application named Explorer that presents a narrative lesson together with dynamic output for real-time experimentation. Sample projects (-sample-) address specific topics, as might appear on StackOverflow or GitHub.