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

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

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

import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import org.jooq.Converter;

@SuppressWarnings("serial")
public class InternetAddressLowerConverter implements Converter {

    @Override public Class fromType() { return String.class; }
    @Override public Class toType() { return InternetAddress.class; }

    @Override
    public InternetAddress from(String x) {
        try {
            if (x == null) return null;
            return new InternetAddress(x);
        }
        catch (AddressException e) { throw new RuntimeException(e); }
    }

    @Override
    public String to(InternetAddress x) {
        if (x == null) return null;
        return x.getAddress().toLowerCase();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy