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

com.github.longdt.vertxorm.repository.RowMapper Maven / Gradle / Ivy

There is a newer version: 2.3.3
Show newest version
package com.github.longdt.vertxorm.repository;

import com.fasterxml.jackson.core.type.TypeReference;
import com.github.longdt.vertxorm.repository.base.BuilderImpl;
import io.vertx.core.json.JsonObject;
import io.vertx.sqlclient.Row;

import java.math.BigDecimal;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;

public interface RowMapper {

    static  Builder builder(String tableName, Supplier supplier) {
        return new BuilderImpl<>(tableName, supplier);
    }

    E map(Row row);

    interface Builder {
        Builder pk(String pkName, Function pkGetter, BiConsumer pkSetter);

        Builder pk(String pkName, Function pkGetter, BiConsumer pkSetter, boolean autogen);

         Builder pkConverter(Function pkGetConverter, Function pkSetConverter);

         Builder addField(String fieldName, Function getter, BiConsumer setter);

         Builder addField(String fieldName, Function getter, BiConsumer setter, Function getConverter, Function setConverter);

        Builder addUuidField(String fieldName, Function getter, BiConsumer setter);

         Builder addJsonField(String fieldName, Function getter, BiConsumer setter, Class clazz);

         Builder addJsonField(String fieldName, Function getter, BiConsumer setter, TypeReference type);

        Builder addDecimalField(String fieldName, Function getter, BiConsumer setter);

        Builder addJsonObjectField(String fieldName, Function getter, BiConsumer setter);

        RowMapper build();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy