Migration

Migrate from Version 2.X to 3.X

Following a list of changes / actions to migration from version 2.x to 3.x.

Translation file locations

In 2.x the default location of the translation resource files was nls/translation. With Version 3.x the default location has change to the package the class calls the init()-method of an adapter. So all used translation files must be moved from nls to the package.

Example:

package com.example.app;

// ... Some includes ...

public class ThisUi extends BaseUI {

  private static final NilsFactory NLS_FACTORY =
      NilsFactory.init(ResourceBundleAdapterConfig.init(ThisUi.class));

  // ... More logic
}

The old location of translation files was nls. The new location is com.example.app.

Core

The following classes / interfaces has been removed:

Class/Interface

Hint

com.codepulsar.nils.api.error.NilsConfigException

The exception was inherited from NilsException. There was no useful use case for 2 types of exceptions.

The following methods were changes / removed:

Old method

New method

Hint

BaseLocalizedResourceNilsConfig(Module, String)

BaseLocalizedResourceNilsConfig(Class<?>, String)

The owning class is used for some name resolving. So change from Module to Class.

BaseLocalizedResourceNilsConfig.getOwner()

BaseLocalizedResourceNilsConfig.getOwnerModule()

-

LocalizedResourceConfig..getOwner()

LocalizedResourceConfig.getOwnerModule()

-

ResourceBundleAdapterConfig.getResourcesBundleName()

ResourceBundleAdapterConfig.getBaseFileName()

Consolidation that all file based adapter uses the same config API.

ResourceBundleAdapterConfig.resourcesBundleName(String)

ResourceBundleAdapterConfig.baseFileName(String)

Consolidation that all file based adapter uses the same config API.

Migrate from Version 1.x to 2.x

Following a list of changes / actions to migration from version 1.x to 2.x.

Core

The following classes / interfaces has been moved and / or renamed:

Version 1.x

Version 2.x

com.codepulsar.nils.core.Formats

com.codepulsar.nils.api.Formats

com.codepulsar.nils.core.NilsConfig

com.codepulsar.nils.api.NilsConfig

com.codepulsar.nils.core.NilsFactory

com.codepulsar.nils.api.NilsFactory

com.codepulsar.nils.core.NLS

com.codepulsar.nils.api.NLS

com.codepulsar.nils.core.adapter.Adapter

com.codepulsar.nils.api.adapter.Adapter

com.codepulsar.nils.core.adapter.AdapterFactory

com.codepulsar.nils.api.adapter.AdapterFactory

com.codepulsar.nils.core.adapter.rb.ResourceBundleAdapter

com.codepulsar.nils.adapter.rb.ResourceBundleAdapter

com.codepulsar.nils.core.adapter.rb.ResourceBundleAdapterConfig

com.codepulsar.nils.adapter.rb.ResourceBundleAdapterConfig

com.codepulsar.nils.core.adapter.rb.ResourceBundleAdapterFactory

com.codepulsar.nils.adapter.rb.ResourceBundleAdapterFactory

com.codepulsar.nils.core.error.ErrorType

com.codepulsar.nils.api.error.ErrorType

com.codepulsar.nils.core.error.NilsConfigException

com.codepulsar.nils.api.error.NilsConfigException

com.codepulsar.nils.core.error.NilsException

com.codepulsar.nils.api.error.NilsException

com.codepulsar.nils.core.adapter.config.LocalizedResourceResolverConfig

com.codepulsar.nils.core.adapter.config.LocalizedResourceConfig

The following classes / interfaces has been removed:

Class/Interface

Hint

com.codepulsar.nils.core.adapter.AdapterConfig

The interface definition was merged with com.codepulsar.nils.api.NilsConfig. Own implementations of adapters must implement NilsConfig instead of AdapterConfig. They can also extend the class com.codepulsar.nils.core.adapter.config.BaseNilsConfig.

The following methods were changes / removed:

Method

Hint

NilsConfig.suppressableErrors(ErrorType, ErrorType …​)

The method has changed its signature to NilsConfig.suppressErrors(boolean).

NilsConfig.includeTag(String …​)

The default include tag has changed from @include to _include. Update your translation files if you use the default include tag there.

Jackson Adapter

The following classes / interfaces has been removed:

Class/Interface

Hint

com.codepulsar.nils.adapter.jackson.JacksonAdapterConfig

The class is now a parent interface for com.codepulsar.nils.adapter.jackson.JacksonAdapterJsonConfig and com.codepulsar.nils.adapter.jackson.JacksonAdapterYamlConfig. Please update your code to the specific adapter config. All properties stays the same.