com.scalar.db.sql.ColumnDefinitions Maven / Gradle / Ivy
package com.scalar.db.sql;
import java.util.Iterator;
import java.util.Set;
/** Metadata about columns of the {@link ResultSet}. */
public interface ColumnDefinitions extends Iterable {
/**
* Returns the column definition for the specified column.
*
* @param columnName a column name
* @return the column definition for the specified column
*/
ColumnDefinition getColumnDefinition(String columnName);
/**
* Returns the i-ith column definition.
*
* @param i the position of the column definitions
* @return the i-ith column definition
*/
ColumnDefinition getColumnDefinition(int i);
/**
* Indicates whether this metadata contains the specified column.
*
* @param columnName a column name
* @return whether this metadata contains the specified column
*/
boolean contains(String columnName);
/**
* Returns the column names of the column definitions contained in this metadata.
*
* @return the column names of the column definitions contained in this metadata
*/
Set getColumnNames();
/**
* Returns the number of the column definitions contained in this metadata.
*
* @return the number of the column definitions contained in this metadata
*/
int size();
@Override
default Iterator iterator() {
return new Iterator() {
private int index;
@Override
public boolean hasNext() {
return index < size();
}
@Override
public ColumnDefinition next() {
return getColumnDefinition(index++);
}
};
}
}