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

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

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

import fi.jubic.easymapper.MappingException;
import org.jooq.Record;
import org.jooq.Table;
import org.jooq.TableField;

public class PlainJooqFieldAccessor implements JooqFieldAccessor {
    private final TableField field;

    public PlainJooqFieldAccessor(TableField field) {
        this.field = field;
    }

    @Override
    public R write(R output, F value) throws MappingException {
        output.set(field, value);
        return output;
    }

    @Override
    public F extract(R input) throws MappingException {
        return input.get(field);
    }

    @Override
    public JooqFieldAccessor alias(Table tableAlias) {
        return new PlainJooqFieldAccessor<>(
                (TableField) tableAlias.field(field.getName(), field.getDataType())
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy