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

com.databasesandlife.util.jooq.LocaleConverter Maven / Gradle / Ivy

There is a newer version: 21.0.1
Show newest version
package com.databasesandlife.util.jooq;

import org.apache.commons.lang3.LocaleUtils;
import org.jooq.Converter;

import java.util.Locale;

@SuppressWarnings({ "serial" })
public class LocaleConverter implements Converter {
    
    @Override public Class fromType() { return String.class; }
    @Override public Class toType() { return Locale.class; }

    @Override
    public Locale from(String x) {
        if (x == null) return null;
        return LocaleUtils.toLocale(x);
    }

    @Override
    public String to(Locale m) {
        if (m == null) return null;
        return m.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy