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

com.scalar.db.sql.ColumnDefinitions Maven / Gradle / Ivy

There is a newer version: 3.14.0
Show newest version
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++);
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy