Class ColumnsMap

java.lang.Object
scriptella.util.ColumnsMap

public class ColumnsMap extends Object
Represents a map of columns accessible by name and index.

This class is useful for queries producing results similar to ResultSet.

Version:
1.0
Author:
Fyodor Kupolov
  • Constructor Details

    • ColumnsMap

      public ColumnsMap()
  • Method Details

    • registerColumn

      public void registerColumn(String name, int index) throws IllegalArgumentException
      Registers column to for later lookup.
      Parameters:
      name - column name.
      index - positive column index.
      Throws:
      IllegalArgumentException - if index has illegal value
    • find

      public Integer find(String name)
      Finds column index by name.
      Parameters:
      name - column name.
      Returns:
      column index, or null if column not found.
    • asIndexNameMap

      public Map<Integer,String> asIndexNameMap()
      Converts this mapping to index->name column map.
      Returns:
      index->name column map.