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

net.morimekta.providence.jdbi.v3.EnumValueArgument Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package net.morimekta.providence.jdbi.v3;

import net.morimekta.providence.PEnumValue;
import org.jdbi.v3.core.argument.Argument;
import org.jdbi.v3.core.statement.StatementContext;

import javax.annotation.Nonnull;
import java.sql.PreparedStatement;
import java.sql.SQLException;

class EnumValueArgument implements Argument {
    private final PEnumValue value;

    public EnumValueArgument(@Nonnull PEnumValue value) {this.value = value;}

    @Override
    public String toString() {
        return value.asInteger() + " (" + value.asString() + ")";
    }

    @Override
    public void apply(int position, PreparedStatement statement, StatementContext ctx)
            throws SQLException {
        statement.setInt(position, value.asInteger());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy