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

fi.jubic.easymapper.jooq.Jooq Maven / Gradle / Ivy

There is a newer version: 0.5.8
Show newest version
package fi.jubic.easymapper.jooq;

import org.jooq.Record;
import org.jooq.TableField;

import java.sql.Timestamp;
import java.time.Instant;
import java.util.function.Function;

public final class Jooq {
    public static  JooqFieldAccessor jooqField(
            TableField field
    ) {
        return new PlainJooqFieldAccessor<>(field);
    }

    public static  JooqFieldAccessor jooqField(
            TableField field,
            Function writeTransform,
            Function extractTransform
    ) {
        return new TransformingJooqFieldAccessor<>(
                field,
                writeTransform,
                extractTransform
        );
    }

    public static  JooqFieldAccessor jooqTimestampField(
            TableField field
    ) {
        return jooqField(
                field,
                Timestamp::from,
                Timestamp::toInstant
        );
    }

    public static 
            JooqReferenceAccessor jooqReference(
            TableField field,
            Function idGetter
    ) {
        return new JooqReferenceAccessor<>(idGetter, jooqField(field));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy