01: /*
02: * This is free software, licensed under the Gnu Public License (GPL)
03: * get a copy from <http://www.gnu.org/licenses/gpl.html>
04: */
05: package henplus.sqlmodel;
06:
07: /**
08: * <p>Title: ColumnFkInfo</p>
09: * <p>Description:<br>
10: * Created on: 01.08.2003</p>
11: * @version $Id: ColumnFkInfo.java,v 1.4 2004/09/22 11:49:32 magrokosmos Exp $
12: * @author <a href="mailto:martin.grotzke@javakaffee.de">Martin Grotzke</a>
13: */
14: public final class ColumnFkInfo {
15:
16: private String _fkName;
17: private String _pkTable;
18: private String _pkColumn;
19:
20: public ColumnFkInfo(String fkName, String pkTable, String pkColumn) {
21: _fkName = fkName;
22: _pkTable = pkTable;
23: _pkColumn = pkColumn;
24: }
25:
26: /**
27: * @return the name of the foreign key.
28: */
29: public String getFkName() {
30: return _fkName;
31: }
32:
33: public boolean equals(Object other) {
34: if (other != null && other instanceof ColumnFkInfo) {
35: ColumnFkInfo o = (ColumnFkInfo) other;
36: if (_fkName != null && !_fkName.equals(o.getFkName())
37: || _fkName == null && o.getFkName() != null) {
38: return false;
39: } else if (_pkTable != null
40: && !_pkTable.equals(o.getPkTable())
41: || _pkTable == null && o.getPkTable() != null) {
42: return false;
43: } else if (_pkColumn != null
44: && !_pkColumn.equals(o.getPkColumn())
45: || _pkColumn == null && o.getPkColumn() != null) {
46: return false;
47: } else {
48: return true;
49: }
50: }
51: return false;
52: }
53:
54: /**
55: * @return the primary key colum name (should this return a Column?)
56: */
57: public String getPkColumn() {
58: return _pkColumn;
59: }
60:
61: /**
62: * @return the name of the primary key table (should this return a Table?)
63: */
64: public String getPkTable() {
65: return _pkTable;
66: }
67:
68: public String toString() {
69: StringBuffer sb = new StringBuffer("ColumnFkInfo [");
70: sb.append("fkName: ").append(_fkName);
71: sb.append(", pkTable: ").append(_pkTable);
72: sb.append(", pkColumn: ").append(_pkColumn);
73: sb.append("]");
74: return sb.toString();
75: }
76:
77: }
|