com.github.paganini2008.devtools.converter.LocaleConverter Maven / Gradle / Ivy
package com.github.paganini2008.devtools.converter;
import java.util.Locale;
import com.github.paganini2008.devtools.LocaleUtils;
/**
* LocaleConverter
*
* @author Fred Feng
* @version 1.0
*/
public class LocaleConverter extends BaseConverter {
private final Converter stringConverter = new Converter() {
public Locale getValue(String source, Locale defaultValue) {
if (source == null) {
return defaultValue;
}
return LocaleUtils.getLocale(source);
}
};
public LocaleConverter() {
put(String.class, stringConverter);
}
}