com.databasesandlife.util.jooq.InternetAddressLowerConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-common Show documentation
Show all versions of java-common Show documentation
Utility classes developed at Adrian Smith Software (A.S.S.)
The newest version!
package com.databasesandlife.util.jooq;
import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import org.jooq.Converter;
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();
}
}