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

ru.spb.devclub.utils.db.SimpleOptionalResultSet Maven / Gradle / Ivy

package ru.spb.devclub.utils.db;

import java.math.BigDecimal;
import java.sql.*;
import java.util.Optional;

/**
 * The simple implementation of {@link ru.spb.devclub.utils.db.OptionalResultSet}.
 *
 * @author Grig Alex
 * @version 0.1.0
 * @see ru.spb.devclub.utils.db.OptionalResultSet
 * @see ru.spb.devclub.utils.db.SimpleBoxedResultSet
 * @since 0.1.0
 */
/* package */class SimpleOptionalResultSet extends SimpleBoxedResultSet implements OptionalResultSet {
    protected SimpleOptionalResultSet(ResultSet resultSet) {
        super(resultSet);
    }

    @Override
    public Optional getOptionalString(int columnIndex) throws SQLException {
        return Optional.ofNullable(getString(columnIndex));
    }

    @Override
    public Optional getOptionalString(String columnName) throws SQLException {
        return Optional.ofNullable(getString(columnName));
    }

    @Override
    public Optional getOptionalBoolean(int columnIndex) throws SQLException {
        return Optional.ofNullable(getBooleanOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalBoolean(String columnName) throws SQLException {
        return Optional.ofNullable(getBooleanOrNull(columnName));
    }

    @Override
    public Optional getOptionalByte(int columnIndex) throws SQLException {
        return Optional.ofNullable(getByteOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalByte(String columnName) throws SQLException {
        return Optional.ofNullable(getByteOrNull(columnName));
    }

    @Override
    public Optional getOptionalShort(int columnIndex) throws SQLException {
        return Optional.ofNullable(getShortOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalShort(String columnName) throws SQLException {
        return Optional.ofNullable(getShortOrNull(columnName));
    }

    @Override
    public Optional getOptionalInt(int columnIndex) throws SQLException {
        return Optional.ofNullable(getIntOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalInt(String columnName) throws SQLException {
        return Optional.ofNullable(getIntOrNull(columnName));
    }

    @Override
    public Optional getOptionalLong(int columnIndex) throws SQLException {
        return Optional.ofNullable(getLongOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalLong(String columnName) throws SQLException {
        return Optional.ofNullable(getLongOrNull(columnName));
    }

    @Override
    public Optional getOptionalFloat(int columnIndex) throws SQLException {
        return Optional.ofNullable(getFloatOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalFloat(String columnName) throws SQLException {
        return Optional.ofNullable(getFloatOrNull(columnName));
    }

    @Override
    public Optional getOptionalDouble(int columnIndex) throws SQLException {
        return Optional.ofNullable(getDoubleOrNull(columnIndex));
    }

    @Override
    public Optional getOptionalDouble(String columnName) throws SQLException {
        return Optional.ofNullable(getDoubleOrNull(columnName));
    }

    @Override
    public Optional getOptionalBytes(int columnIndex) throws SQLException {
        return Optional.ofNullable(getBytes(columnIndex));
    }

    @Override
    public Optional getOptionalBytes(String columnName) throws SQLException {
        return Optional.ofNullable(getBytes(columnName));
    }

    @Override
    public Optional getOptionalDate(int columnIndex) throws SQLException {
        return Optional.ofNullable(getDate(columnIndex));
    }

    @Override
    public Optional getOptionalDate(String columnName) throws SQLException {
        return Optional.ofNullable(getDate(columnName));
    }

    @Override
    public Optional




© 2015 - 2024 Weber Informatics LLC | Privacy Policy