Expanders 5.30.0
This release of Expanders is the final push to remove all uses of net.palver.util.Options.Option in our JEE stack.
Resources
The expansion resources below provide Expanders 5.30.0.
| Resource | Version |
|---|---|
| Expanders | 5.30.1 |
| nsx-default-stack | 2023.14.1 |
| rest-jaxrs-stack | 3.23.0 |
Some very specific fixes were made after the release of 5.30.0 itself, hence the discrepancy in versions here. But
this is not relevant for projects that were already on 3.28.0 and use Java 17. But it is best to use the latest
versions anyway.
Changes and improvements
Fully deprecating Options.Option
This last refactoring of Options.Option to Optional in the application stack required reworking code across several
projects. Extensive changes were made to nsx-runtime, Expanders, base-components and alerting-component. We did
manage however to reduce the impact of the changes to a minimum, so most projects will experience little impact from the
migration.
We did choose to introduce a hard breaking change in one location, namely the getProperty() method of the expanded
<component>ApplicationSettings class when the option configuration.properties
is added to a component. The use of this option is still fairly limited at this time, so it seemed better to go for some
minor refactoring in those projects that use it, than to add a new method like we did in Context and SearchResult.
The Options.Option class itself will still be available for quite some time, so projects can migrate to Optional on
their own time, but we do intend to remove it in the future.
Migration guide
Migrating to Optional
Imports
We removed all expanded imports of Options.Option, Options.some() and Options.none(). This will mostly impact
custom code that used it in the <dataElement>Cruds and <dataElement>Bean classes. It is recommended to refactor
any code still using Options.Option to Optional immediately. Alternatively, these imports can be added temporarily
in custom code or in case of wide-spread use, you could create an expander that adds them back in as a feature.
getCustomDisplayName()
In case of the <dataElement>Cruds class, the method getCustomDisplayName() returned Options.Option and encouraged
the use of result = some("value"); in custom code to override the display name. Given that this was already using and
suggesting the Options.some(String) added by a static import, we added a temporary deprecated method
Optional<String> some(String) with the same signature to ensure that the majority of projects with a customization
here would not break. It is advised to replace the custom result = some("value"); with
result = Optional.of("value"); as soon as possible though. Projects targeting Java 9 or later will also get a
since and forRemoval fields added to the @Deprecated annotation on the new some() method.
ApplicationSettings
As mentioned above, the <component>ApplicationSettings.getProperty() method now returns Optional instead of
Options.Option. So here it is simply a matter of replacing the relevant methods for those that do not have the same
signature, and/or the type of any variable or field that the return value of getProperty() is assigned to.
CSV related classes
The methods net.democritus.upload.ImportFile.getParameter(String) and
net.democritus.upload.ExportQuery.getParameter(String) now return Optional. These should pretty much never be used
outside expanded code though, so projects should not experience any issues there. All expanded code that used these,
called .orElse() directly on the method result, which also exists in Optional, so this did not even have to change.
