Package adams.db
Class ColumnMapping
- java.lang.Object
-
- adams.db.ColumnMapping
-
public class ColumnMapping extends Object
Implements a set of table columns, mapping names to sql types- Version:
- $Revision$
- Author:
- dale
-
-
Field Summary
Fields Modifier and Type Field Description protected Hashtable<String,ColumnType>m_Mappingname -> type mappingprotected Stringm_PrimaryKeyprimary key
-
Constructor Summary
Constructors Constructor Description ColumnMapping()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMapping(String cname, ColumnType typ)Add a 'column', name-> sql type mappingColumnTypegetMapping(String cname)Get the sql type for a column nameStringgetPrimaryKey()Get primary key columnbooleanhasPrimaryKey()Does this mapping contain a primary key column?Enumeration<String>keys()Return all columns as an enumerationvoidsetPrimaryKey(String id)Set Column name that is primary keyintsize()Get number of columnsStringtoString()Returns a string representation of the column mapping.
-
-
-
Field Detail
-
m_PrimaryKey
protected String m_PrimaryKey
primary key
-
m_Mapping
protected Hashtable<String,ColumnType> m_Mapping
name -> type mapping
-
-
Method Detail
-
addMapping
public void addMapping(String cname, ColumnType typ)
Add a 'column', name-> sql type mapping- Parameters:
cname- column nametyp- 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
-
-