KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > tool > hbm2ddl > ForeignKeyMetadata


1 //$Id: ForeignKeyMetadata.java,v 1.2 2004/08/13 08:05:47 oneovthafew Exp $
2
package org.hibernate.tool.hbm2ddl;
3
4 import java.sql.ResultSet JavaDoc;
5 import java.sql.SQLException JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.List JavaDoc;
8
9 /**
10  * JDBC foreign key metadata
11  * @author Christoph Sturm
12  */

13 public class ForeignKeyMetadata {
14     private final String JavaDoc name;
15     private final List JavaDoc columns = new ArrayList JavaDoc();
16
17     ForeignKeyMetadata(ResultSet JavaDoc rs) throws SQLException JavaDoc {
18         name = rs.getString("FK_NAME");
19     }
20
21     public String JavaDoc getName() {
22         return name;
23     }
24
25     void addColumn(ColumnMetadata column) {
26         if (column != null) columns.add(column);
27     }
28
29     public ColumnMetadata[] getColumns() {
30         return (ColumnMetadata[]) columns.toArray(new ColumnMetadata[0]);
31     }
32
33     public String JavaDoc toString() {
34         return "ForeignKeyMetadata(" + name + ')';
35     }
36 }
37
38
39
40
41
42
43
Popular Tags