1 21 22 package org.dbunit.dataset; 23 24 25 34 public class LowerCaseTableMetaData extends AbstractTableMetaData 35 { 36 private final String _tableName; 37 private final Column[] _columns; 38 private final Column[] _primaryKeys; 39 40 public LowerCaseTableMetaData(String tableName, Column[] columns) 41 { 43 this(tableName, columns, new Column[0]); 44 } 45 46 public LowerCaseTableMetaData(String tableName, Column[] columns, 47 String [] primaryKeys) { 49 this(tableName, columns, getPrimaryKeys(columns, primaryKeys)); 50 } 51 52 public LowerCaseTableMetaData(ITableMetaData metaData) throws DataSetException 53 { 54 this(metaData.getTableName(), metaData.getColumns(), 55 metaData.getPrimaryKeys()); 56 } 57 58 public LowerCaseTableMetaData(String tableName, Column[] columns, 59 Column[] primaryKeys) { 61 _tableName = tableName.toLowerCase(); 62 _columns = createLowerColumns(columns); 63 _primaryKeys = createLowerColumns(primaryKeys); 64 } 65 66 private Column[] createLowerColumns(Column[] columns) 67 { 68 Column[] lowerColumns = new Column[columns.length]; 69 for (int i = 0; i < columns.length; i++) 70 { 71 lowerColumns[i] = createLowerColumn(columns[i]); 72 } 73 74 return lowerColumns; 75 } 76 77 private Column createLowerColumn(Column column) 78 { 79 return new Column( 80 column.getColumnName().toLowerCase(), 81 column.getDataType(), 82 column.getSqlTypeName(), 83 column.getNullable()); 84 } 85 86 89 public String getTableName() 90 { 91 return _tableName; 92 } 93 94 public Column[] getColumns() 95 { 96 return _columns; 97 } 98 99 public Column[] getPrimaryKeys() 100 { 101 return _primaryKeys; 102 } 103 } 104 105 106 107 108 109 | Popular Tags |