org.jboss.resteasy.reactive.common.headers.LocaleDelegate Maven / Gradle / Ivy
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);
}
}