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

io.castled.kafka.ConfigArgumentFactory Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package io.castled.kafka;

import io.castled.utils.JsonUtils;
import org.apache.kafka.common.config.AbstractConfig;
import org.jdbi.v3.core.argument.AbstractArgumentFactory;
import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.config.ConfigRegistry;

import java.sql.Types;

public class ConfigArgumentFactory extends AbstractArgumentFactory {

    protected ConfigArgumentFactory() {
        super(Types.VARCHAR);
    }

    @Override
    protected Argument build(AbstractConfig config, ConfigRegistry registry) {
        return (position, statement, ctx) -> statement.setString(position, JsonUtils.objectToString(config.originals()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy