Migration to 1.4.x

Mordechai Meisels edited this page Jan 3, 2019 · 6 revisions

Update4j version 1.4.0 bought us a few new features and breaking changes. This document should help you move your existing project to the newest version.

1. Dependency Injection

In order to decouple the bootstrap and business application, 1.4.0 introduces a dependency injection framework. Read how to use it in the JavaDoc. To complement this newly added feature, we decided to remove the old way of communication:

  • You can no longer pass a List<String> to Configuration.update().
  • LaunchContext.getArgs() has been removed.
  • You can no longer pass a Consumer<UpdateHandler> or Consumer<Launcher> to Configuration.update() or Configuration.launch() respectively.

2. Explicit Service Provider

There was always a possibility to express the service provider class name. For delegates you would use the --delegate command line argument and for update handler or launcher you would use the <provider> element in the configuration file.

It used to be, this would only override the versioning of the registered providers. If the provider was missing, it would not fail, instead it would fall back to the highest version.

Version 1.4.0 will now try to load the class even if it was not registered as a provider — as required by ServiceLoader. But this time, if the class is not found it will fail instead of falling back to the highest registered version.

3. Changes in --delegate switch

The --delegate switch now must be the first argument in the args list followed by the class name. --delegate and the class name will then be stripped from the argument list before being forwarded to the delegate.

4. Removal of many getXxxProperty()

Version 1.4.0 removed many confusing and counter-productive property getters, leaving only:

public List<Property> getProperties()

public List<Property> getProperties(String key)

public Map<String, String> getResolvedProperties()

public String getResolvedProperty(String key)

5. Configuration.getTimestamp() returns null if missing

If the timestamp attribute was not present in the config, Configuration.getTimestamp() would return the time the config object was read. This wasn't very useful. Instead it will now return null.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.