org.sql2o.converters.UUIDConverter Maven / Gradle / Ivy
package org.sql2o.converters;
import java.util.UUID;
/**
* Used by sql2o to convert a value from the database into a {@link UUID}.
*/
public class UUIDConverter extends ConverterBase {
public UUID convert(Object val) throws ConverterException {
if (val == null){
return null;
}
if (val instanceof UUID){
return (UUID)val;
}
if(val instanceof String){
return UUID.fromString((String) val);
}
throw new ConverterException("Cannot convert type " + val.getClass() + " " + UUID.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy