Package adams.db

Class ColumnMapping


  • public class ColumnMapping
    extends Object
    Implements a set of table columns, mapping names to sql types
    Version:
    $Revision$
    Author:
    dale
    • Constructor Detail

      • ColumnMapping

        public ColumnMapping()
        Constructor
    • Method Detail

      • addMapping

        public void addMapping​(String cname,
                               ColumnType typ)
        Add a 'column', name-> sql type mapping
        Parameters:
        cname - column name
        typ - sql type
      • getMapping

        public ColumnType getMapping​(String cname)
        Get the sql type for a column name
        Parameters:
        cname - column name
        Returns:
        sql type
      • keys

        public Enumeration<String> keys()
        Return all columns as an enumeration
        Returns:
        column names
      • size

        public int size()
        Get number of columns
        Returns:
        number of columns
      • setPrimaryKey

        public void setPrimaryKey​(String id)
        Set Column name that is primary key
        Parameters:
        id - column name
      • hasPrimaryKey

        public boolean hasPrimaryKey()
        Does this mapping contain a primary key column?
        Returns:
        has primary key?
      • getPrimaryKey

        public String getPrimaryKey()
        Get primary key column
        Returns:
        column name
      • toString

        public String toString()
        Returns a string representation of the column mapping.
        Overrides:
        toString in class Object
        Returns:
        the string representation