Skip to main content

Expanders 5.22.0

· 2 min read
Frédéric Hannes
Frédéric Hannes
R&D Engineer

Over the last year we've put a lot of effort into modernizing our NS application stack and improving its quality. This release of expanders marks the start of a new and important step in that process. We are starting to remove the use of net.palver.util.Options.Option in favor of Java's java.util.Optional.

Resources

The expansion resources below provide Expanders 5.22.0.

ResourceVersion
Expanders5.22.0
nsx-default-stack2023.6.0
rest-jaxrs-stack3.12.0

Changes and improvements

Optional

We will be rolling out these changes in stages, as they will be considerably impactful. Though the first steps have been taken in this release, we have started by refactoring a bunch of code that has limited external use and cleaning up legacy code that is no longer in use which also used Options.Option.

Most changes for this release are actually part of the nsx-runtime library, version 2023.1.0. The expanders release and release of several other expansion resources is mostly to update affected code in the expanders themselves or expanded by them. If there is any impact from these changes, it will most likely be from the use of the component metadata system. You can refer to the nsx-runtime changelog for a comprehensive list of these changes. Where methods previously returned Options.Option, they now return Optional, which has a few differences in method signatures that will require refactoring:

  • Options.Option.isDefined()
    Optional.isPresent()
  • Options.Option.isEmpty()
    Optional.isEmpty() for Java 11 or 17, !Optional.isPresent() for Java 8
  • Options.Option.getValue()
    Optional.get()
  • Options.some()
    Optional.of()
  • Options.notNull()
    Optional.ofNullable()
  • Options.none()
    Optional.empty()

Where possible, it is prudent to use Options.Option.asOptional() in custom code, which should make it easier to refactor for future changes.