1 21 22 package org.dbunit.dataset; 23 24 30 public class CaseInsensitiveTable implements ITable 31 { 32 private final ITable _table; 33 34 public CaseInsensitiveTable(ITable table) 35 { 36 _table = table; 37 } 38 39 private String getInternalColumnName(String columnName) 40 throws DataSetException 41 { 42 Column[] columns = _table.getTableMetaData().getColumns(); 43 44 for (int i = 0; i < columns.length; i++) 45 { 46 Column column = columns[i]; 47 if (columnName.equalsIgnoreCase(column.getColumnName())) 48 { 49 return column.getColumnName(); 50 } 51 } 52 53 throw new NoSuchColumnException(_table.getTableMetaData().getTableName() + "." + columnName); 54 } 55 56 59 public ITableMetaData getTableMetaData() 60 { 61 return _table.getTableMetaData(); 62 } 63 64 public int getRowCount() 65 { 66 return _table.getRowCount(); 67 } 68 69 public Object getValue(int row, String column) throws DataSetException 70 { 71 return _table.getValue(row, getInternalColumnName(column)); 72 } 73 } 74 75 76 77 | Popular Tags |