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

org.itsallcode.jdbc.resultset.generic.Row Maven / Gradle / Ivy

package org.itsallcode.jdbc.resultset.generic;

import java.util.List;

/**
 * Represents a generic row from a result set.
 * 
 * @param rowIndex     row index (zero based)
 * @param columns      column metadata
 * @param columnValues values for each column
 */
public record Row(int rowIndex, List columns, List columnValues) {

    /**
     * Get the value at a given column index (zero based).
     * 
     * @param columnIndex column index (zero based)
     * @return column value
     */
    public ColumnValue get(final int columnIndex) {
        return columnValues.get(columnIndex);
    }

    /**
     * Get the value at a given column index (zero based) converted to the given
     * type.
     * 
     * @param columnIndex column index (zero based)
     * @param type        expected type
     * @param          expected type
     * @return column value
     */
    public  T get(final int columnIndex, final Class type) {
        return get(columnIndex).getValue(type);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy