View Javadoc
1 /* 2 * Created on 2003-6-11 10:59:06 by joel guo 3 * 4 * vTradEx Information Technology Inc. 5 */ 6 package com.cyclops.dbdigger.schema; 7 import java.util.Iterator; 8 9 import com.cyclops.dbdigger.schema.torque.TorqueColumn; 10 import com.cyclops.dbdigger.util.ArrayMap; 11 /*** Add description <font color="red">HERE</font>! 12 * 13 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a> 14 * @since 2003-6-11 10:59:06 15 */ 16 public class DefaultTable implements Table { 17 private ArrayMap columns = new ArrayMap(); 18 private Database database; 19 private String description; 20 private String javaClassName; 21 private String name; 22 private Column primaryKey; 23 /*** Method addColumn() in class DefaultTable 24 * @param column Column object to be added into this Table 25 */ 26 public void addColumn(Column column) { 27 columns.put(column.getName(), column); 28 if (column instanceof TorqueColumn) { 29 ((TorqueColumn) column).setTable(this); 30 } 31 } 32 /*** Override method getColumn() in super class 33 * @see com.cyclops.digger.schema.Table#getColumn(java.lang.String) 34 */ 35 public Column getColumn(String columnName) { 36 return (Column) columns.get(columnName); 37 } 38 /*** Override method getColumns() in super class 39 * @see com.cyclops.digger.schema.Table#getColumns() 40 */ 41 public Column[] getColumns() { 42 return (Column[]) columns.values().toArray(Column.EMPTY_ARRAY); 43 } 44 /*** Override method getDatabase() in super class 45 * @see com.cyclops.digger.schema.Table#getDatabase() 46 */ 47 public Database getDatabase() { 48 return database; 49 } 50 /*** Override method getDescription() of super class 51 * @see com.cyclops.digger.schema.Table#getDescription() 52 */ 53 public String getDescription() { 54 return description; 55 } 56 /*** Override method getJavaClassName() in super class 57 * @see com.cyclops.digger.schema.Table#getNameInDB() 58 */ 59 public String getJavaClassName() { 60 return javaClassName; 61 } 62 /*** Override method getName() in super class 63 * @see com.cyclops.digger.schema.Table#getName() 64 */ 65 public String getName() { 66 return name; 67 } 68 /*** Override method getPrimaryKey() in super class 69 * @see com.cyclops.digger.schema.Table#getPrimaryKey() 70 */ 71 public Column getPrimaryKey() { 72 Column ret = null; 73 for (Iterator i = columns.values().iterator(); i.hasNext();) { 74 Column column = (Column) i.next(); 75 if (column.isPrimaryKey()) { 76 ret = column; 77 break; 78 } 79 } 80 return ret; 81 } 82 /*** Method setDatabase() in class DefaultTable 83 * @param adatabase Database object this Table belong to 84 */ 85 public void setDatabase(Database adatabase) { 86 database = adatabase; 87 } 88 /*** Method setDescription() 89 * @param string Description of this Table 90 */ 91 public void setDescription(String string) { 92 description = string; 93 } 94 /*** Method setJavaClassName() 95 * @param string Full java class name 96 */ 97 public void setJavaClassName(String string) { 98 javaClassName = string; 99 } 100 /*** Method setName() in class DefaultTable 101 * @param string Name of this Column in database 102 */ 103 public void setName(String string) { 104 name = string; 105 } 106 }

This page was automatically generated by Maven