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

org.jboss.resteasy.reactive.common.headers.LocaleDelegate Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package org.jboss.resteasy.reactive.common.headers;

import java.util.Locale;

import jakarta.ws.rs.ext.RuntimeDelegate;

import org.jboss.resteasy.reactive.common.util.LocaleHelper;

/**
 * @author Bill Burke
 */
public class LocaleDelegate implements RuntimeDelegate.HeaderDelegate {
    public static final LocaleDelegate INSTANCE = new LocaleDelegate();

    public Locale fromString(String value) throws IllegalArgumentException {
        if (value == null)
            throw new IllegalArgumentException("param was null");
        return LocaleHelper.extractLocale(value);
    }

    public String toString(Locale value) {
        if (value == null)
            throw new IllegalArgumentException("param was null");
        return LocaleHelper.toLanguageString(value);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy