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

com.softicar.platform.common.core.locale.CurrentLocale Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.locale;

import com.softicar.platform.common.core.singleton.Singleton;

/**
 * This {@link Singleton} holds the currently selected {@link ILocale}.
 *
 * @author Oliver Richers
 */
public class CurrentLocale {

	private static final ILocale DEFAULT_LOCALE = new Locale();
	private static final Singleton CURRENT_LOCALE = new Singleton<>(() -> DEFAULT_LOCALE).setInheritByIdentity();

	/**
	 * Returns the current {@link ILocale} to use.
	 *
	 * @return the current {@link ILocale} (never null)
	 */
	public static ILocale get() {

		return CURRENT_LOCALE.get();
	}

	/**
	 * Sets the current {@link ILocale} to the specified value.
	 *
	 * @param locale
	 *            the {@link ILocale} to use or null to reset to default
	 */
	public static void set(ILocale locale) {

		CURRENT_LOCALE.set(locale);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy