KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbunit > dataset > DefaultTableMetaData


1 /*
2  *
3  * The DbUnit Database Testing Framework
4  * Copyright (C)2002-2004, DbUnit.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */

21
22 package org.dbunit.dataset;
23
24 import java.util.Arrays JavaDoc;
25
26
27 /**
28  * @author Manuel Laflamme
29  * @version $Revision: 1.10 $
30  * @since Feb 17, 2002
31  */

32 public class DefaultTableMetaData extends AbstractTableMetaData
33 {
34     private final String JavaDoc _tableName;
35     private final Column[] _columns;
36     private final Column[] _primaryKeys;
37
38     public DefaultTableMetaData(String JavaDoc tableName, Column[] columns)
39             //throws DataSetException
40
{
41         this(tableName, columns, new String JavaDoc[0]);
42     }
43
44     public DefaultTableMetaData(String JavaDoc tableName, Column[] columns,
45             String JavaDoc[] primaryKeys) //throws DataSetException
46
{
47         _tableName = tableName;
48         _columns = columns;
49         _primaryKeys = getPrimaryKeys(columns, primaryKeys);
50     }
51
52     public DefaultTableMetaData(String JavaDoc tableName, Column[] columns,
53             Column[] primaryKeys) //throws DataSetException
54
{
55         _tableName = tableName;
56         _columns = columns;
57         _primaryKeys = primaryKeys;
58     }
59
60     public String JavaDoc toString()
61     {
62         return "tableName=" + _tableName +
63                 ", columns=" + Arrays.asList(_columns) +
64                 ", keys=" + Arrays.asList(_primaryKeys) + "";
65     }
66
67     ////////////////////////////////////////////////////////////////////////////
68
// ITableMetaData interface
69

70     public String JavaDoc getTableName()
71     {
72         return _tableName;
73     }
74
75     public Column[] getColumns()
76     {
77         return _columns;
78     }
79
80     public Column[] getPrimaryKeys()
81     {
82         return _primaryKeys;
83     }
84 }
85
86
87
88
89
90
Popular Tags