Class DelegatingResultRow

java.lang.Object
cz.cvut.kbss.ontodriver.iteration.DelegatingResultRow
All Implemented Interfaces:
ResultRow

public class DelegatingResultRow extends Object implements ResultRow
ResultRow implementation which delegates retrieval calls to the underlying ResultSet.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    findColumn(String columnLabel)
    Retrieves index of a column with the specified label.
    boolean
    getBoolean(int columnIndex)
    Retrieves value from column at the specified index and returns it as a boolean.
    boolean
    getBoolean(String columnLabel)
    Retrieves value from column with the specified label and returns it as a boolean.
    byte
    getByte(int columnIndex)
    Retrieves value from column at the specified index and returns it as byte.
    byte
    getByte(String columnLabel)
    Retrieves value from column with the specified label and returns it as byte.
    int
    Gets the count of available columns.
    double
    getDouble(int columnIndex)
    Retrieves value from column at the specified index and returns it as double.
    double
    getDouble(String columnLabel)
    Retrieves value from column with the specified label and returns it as double.
    float
    getFloat(int columnIndex)
    Retrieves value from column at the specified index and returns it as float.
    float
    getFloat(String columnLabel)
    Retrieves value from column with the specified label and returns it as float.
    int
    Gets the index of this row (first row has index 0).
    int
    getInt(int columnIndex)
    Retrieves value from column at the specified index and returns it as int.
    int
    getInt(String columnLabel)
    Retrieves value from column with the specified label and returns it as int.
    long
    getLong(int columnIndex)
    Retrieves value from column at the specified index and returns it as long.
    long
    getLong(String columnLabel)
    Retrieves value from column with the specified label and returns it as long.
    getObject(int columnIndex)
    Retrieves value from column at the specified index and returns it as Object.
    <T> T
    getObject(int columnIndex, Class<T> cls)
    Retrieves value from column at the specified index and returns it as an instance of the specified class.
    getObject(String columnLabel)
    Retrieves value from column with the specified label and returns it as Object.
    <T> T
    getObject(String columnLabel, Class<T> cls)
    Retrieves value from column with the specified label and returns it as an instance of the specified class.
    short
    getShort(int columnIndex)
    Retrieves value of column at the specified index and returns it as short.
    short
    getShort(String columnLabel)
    Retrieves value of column with the specified label and returns it as short.
    getString(int columnIndex)
    Retrieves value of column at the specified index and returns it as String.
    getString(String columnLabel)
    Retrieves value of column with the specified label and returns it as String.
    boolean
    isBound(int variableIndex)
    Checks whether a value at the specified index is bound in the current result row.
    boolean
    isBound(String variableName)
    Checks whether a value of the specified variable is bound in the current result row.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DelegatingResultRow

      public DelegatingResultRow(ResultSet resultSet)
  • Method Details

    • findColumn

      public int findColumn(String columnLabel)
      Description copied from interface: ResultRow
      Retrieves index of a column with the specified label.
      Specified by:
      findColumn in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      index of the column or -1 if there is no such column
    • getColumnCount

      public int getColumnCount()
      Description copied from interface: ResultRow
      Gets the count of available columns.

      This number corresponds to the number of result variables bound in the query.

      Specified by:
      getColumnCount in interface ResultRow
      Returns:
      Number of columns in the result set
    • isBound

      public boolean isBound(int variableIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Checks whether a value at the specified index is bound in the current result row.

      Note that this method will return false also in case the index is out of range of the variables known to the result set as a whole.

      Specified by:
      isBound in interface ResultRow
      Parameters:
      variableIndex - Index of the variable
      Returns:
      true when value is bound in the current row, false otherwise
      Throws:
      OntoDriverException - When unable to resolve binding status
    • isBound

      public boolean isBound(String variableName) throws OntoDriverException
      Description copied from interface: ResultRow
      Checks whether a value of the specified variable is bound in the current result row.

      Note that this method will return false also in case the variable is not known to the result set at all.

      Specified by:
      isBound in interface ResultRow
      Parameters:
      variableName - Variable name
      Returns:
      true when value is bound in the current row, false otherwise
      Throws:
      OntoDriverException - When unable to resolve binding status
    • getBoolean

      public boolean getBoolean(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as a boolean.
      Specified by:
      getBoolean in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      boolean value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to boolean or there occurs some other error
    • getBoolean

      public boolean getBoolean(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as a boolean.
      Specified by:
      getBoolean in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      boolean value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to boolean or there occurs some other error
    • getByte

      public byte getByte(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as byte.
      Specified by:
      getByte in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      byte value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to byte or there occurs some other error
    • getByte

      public byte getByte(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as byte.
      Specified by:
      getByte in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      byte value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to byte or there occurs some other error
    • getDouble

      public double getDouble(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as double.
      Specified by:
      getDouble in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      double value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to double or there occurs some other error
    • getDouble

      public double getDouble(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as double.
      Specified by:
      getDouble in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      double value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to double or there occurs some other error
    • getFloat

      public float getFloat(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as float.
      Specified by:
      getFloat in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      float value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to float or there occurs some other error
    • getFloat

      public float getFloat(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as float.
      Specified by:
      getFloat in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      float value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to float or there occurs some other error
    • getInt

      public int getInt(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as int.
      Specified by:
      getInt in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      int value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to int or there occurs some other error
    • getInt

      public int getInt(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as int.
      Specified by:
      getInt in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      int value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to int or there occurs some other error
    • getLong

      public long getLong(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as long.
      Specified by:
      getLong in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      long value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to long or there occurs some other error
    • getLong

      public long getLong(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as long.
      Specified by:
      getLong in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      long value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to long or there occurs some other error
    • getObject

      public Object getObject(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as Object.
      Specified by:
      getObject in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      column value cast to Object
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index or there occurs some other error
    • getObject

      public Object getObject(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as Object.
      Specified by:
      getObject in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      column value cast to Object
      Throws:
      OntoDriverException - If there is no column with the specified label or there occurs some other error
    • getObject

      public <T> T getObject(int columnIndex, Class<T> cls) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column at the specified index and returns it as an instance of the specified class.

      The mechanism of transforming the value to the specified class is not specified, it can be merely type casting or calling a constructor of the specified type.

      Specified by:
      getObject in interface ResultRow
      Type Parameters:
      T - Return type
      Parameters:
      columnIndex - Column index, the first column has index 0
      cls - Requested class type
      Returns:
      Value of the column
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to the specified type or there occurs some other error
    • getObject

      public <T> T getObject(String columnLabel, Class<T> cls) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value from column with the specified label and returns it as an instance of the specified class.

      The mechanism of transforming the value to the specified class is not specified, it can be merely type casting or calling a constructor of the specified type.

      Specified by:
      getObject in interface ResultRow
      Type Parameters:
      T - Return type
      Parameters:
      columnLabel - Label of the column
      cls - Requested class type
      Returns:
      Value of the column.
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to the specified type or there occurs some other error
    • getShort

      public short getShort(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value of column at the specified index and returns it as short.
      Specified by:
      getShort in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      short value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to short or there occurs some other error
    • getShort

      public short getShort(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value of column with the specified label and returns it as short.
      Specified by:
      getShort in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      short value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to short or there occurs some other error
    • getString

      public String getString(int columnIndex) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value of column at the specified index and returns it as String.
      Specified by:
      getString in interface ResultRow
      Parameters:
      columnIndex - Column index, the first column has index 0
      Returns:
      String value
      Throws:
      OntoDriverException - If the columnIndex is not a valid column index, the value cannot be cast to String or there occurs some other error
    • getString

      public String getString(String columnLabel) throws OntoDriverException
      Description copied from interface: ResultRow
      Retrieves value of column with the specified label and returns it as String.
      Specified by:
      getString in interface ResultRow
      Parameters:
      columnLabel - Label of the column
      Returns:
      String value
      Throws:
      OntoDriverException - If there is no column with the specified label, the value cannot be cast to String or there occurs some other error
    • getIndex

      public int getIndex() throws OntoDriverException
      Description copied from interface: ResultRow
      Gets the index of this row (first row has index 0).
      Specified by:
      getIndex in interface ResultRow
      Returns:
      Index of this row
      Throws:
      OntoDriverException - If some other error occurs