Open Source Repository

Home /ibatis/ibatis-sqlmap-3.0-beta8 | Repository Home



org/apache/ibatis/metadata/Table.java
package org.apache.ibatis.metadata;

import java.util.HashMap;
import java.util.Map;

public class Table {
  private String name;
  private String catalog;
  private String schema;
  private Map columns = new HashMap();
  private Column primaryKey;

  public Table(String name) {
    this.name = name;
  }

  public String getName() {
    return name;
  }

  public String getCatalog() {
    return catalog;
  }

  public void setCatalog(String catalog) {
    this.catalog = catalog;
  }

  public String getSchema() {
    return schema;
  }

  public void setSchema(String schema) {
    this.schema = schema;
  }

  public void addColumn(Column col) {
    columns.put(col.getName().toUpperCase(), col);
  }

  public Column getColumn(String name) {
    return (Columncolumns.get(name.toUpperCase());
  }

  public String[] getColumnNames() {
    return (String[]) columns.keySet().toArray(new String[columns.size()]);
  }

  public void setPrimaryKey(Column column) {
    primaryKey = column;
  }

  public Column getPrimaryKey() {
    return primaryKey;
  }

  public boolean equals(Object o) {
    if (this == oreturn true;
    if (o == null || getClass() != o.getClass()) return false;
    final Table table = (Tableo;
    if (name != null ? !name.equals(table.name: table.name != nullreturn false;
    return true;
  }

  public int hashCode() {
    return (name != null ? name.hashCode() 0);
  }

}