All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codepulsar.nils.adapter.jackson.JacksonAdapterJsonConfig Maven / Gradle / Ivy

Go to download

The Jackson Adapter for NILS - A Java NLS library (aka national language support, localisation, internationalisation, i18n, l10n) using JSON files as resources.

The newest version!
package com.codepulsar.nils.adapter.jackson;

import static com.codepulsar.nils.core.error.ErrorTypes.CONFIG_ERROR;
import static com.codepulsar.nils.core.util.ParameterCheck.nilsException;
import static com.codepulsar.nils.core.util.ParameterCheck.notNull;

import com.codepulsar.nils.api.adapter.AdapterFactory;
import com.codepulsar.nils.core.adapter.config.BaseLocalizedResourceNilsConfig;

/**
 * Configuration for the {@link JacksonAdapter} implementation for {@code json} files.
 *
 * 

The default base file name is the package of the Class resolved in {@link #init(Class)} or * {@link #init(Object)} + "translation.json". */ public class JacksonAdapterJsonConfig extends BaseLocalizedResourceNilsConfig implements JacksonAdapterConfig { private JacksonAdapterJsonConfig(Class owner) { super(owner, ".json"); } @Override public Class> getFactoryClass() { return JacksonAdapterFactory.class; } /** * Create a {@linkplain JacksonAdapterJsonConfig} from a class as reference. * *

Note: The {@code Class} will be used for resolving and accessing the translation * files. * * @param owner A Class * @return The created {@linkplain JacksonAdapterJsonConfig}. */ public static JacksonAdapterJsonConfig init(Class owner) { notNull(owner, "owner", nilsException(CONFIG_ERROR)); return new JacksonAdapterJsonConfig(owner); } /** * Create a {@linkplain JacksonAdapterJsonConfig} from an object as reference. * *

Note: The object's class will be used for resolving and accessing the translation * files. * * @param owner An object * @return The created {@linkplain JacksonAdapterJsonConfig}. */ public static JacksonAdapterJsonConfig init(Object owner) { notNull(owner, "owner", nilsException(CONFIG_ERROR)); return init(owner.getClass()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy