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

dps.webapplication.i18n.AbstractLocale Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package dps.webapplication.i18n;

import javax.inject.Inject;
import java.util.Locale;

abstract public class AbstractLocale {

    @Inject
    Locales locales;

    protected Locale locale;

    abstract AbstractLocale getParentLocale();

    public Locale getLocale() {
        if (locale == null) {
            AbstractLocale parentLocale = getParentLocale();
            if (parentLocale == null) throw new NullPointerException();
            return parentLocale.getLocale();
        }
        return locale;
    }
    public void setLocale(String languageTag) {
        this.setLocale(locales.getLocale(languageTag));
    }
    public void setLocale(Locale locale) {
        this.locale = locale;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy