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

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

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

import org.jooq.Converter;

@SuppressWarnings({ "serial" })
public class MySqlBooleanConverter implements Converter {

    @Override public Class fromType() { return Byte.class; }
    @Override public Class toType() { return Boolean.class; }

    @Override
    public Boolean from(Byte x) {
        if (x == null) return null;
        if (x == (byte)0) return false;
        return true;
    }

    @Override
    public Byte to(Boolean m) {
        if (m == null) return null;
        return m ? (byte)1 : 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy