org.sql2o.converters.UUIDConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of anima Show documentation
Show all versions of anima Show documentation
Operate the database like a stream
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