KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > util > db > TableColumn


1 package org.apache.turbine.util.db;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 /**
20  * Models a specific column in a specific table.
21  *
22  * @author <a HREF="mailto:dlr@collab.net">Daniel Rall</a>
23  * @author <a HREF="mailto:jmcnally@collab.net">John McNally</a>
24  * @version $Id: TableColumn.java,v 1.4.2.2 2004/05/20 03:18:44 seade Exp $
25  * @deprecated Use <a HREF="http://db.apache.org/torque/">Torque</a>.
26  */

27 public class TableColumn
28 {
29     /**
30      * The name of the database table.
31      */

32     protected String JavaDoc tableName;
33
34     /**
35      * The name of the database column.
36      */

37     protected String JavaDoc columnName;
38
39     /**
40      * The concatenation of the table name and column name separated with a
41      * dot.
42      */

43     private String JavaDoc tableColumn;
44
45     public TableColumn(String JavaDoc tableName, String JavaDoc columnName)
46     {
47         this.tableName = tableName;
48         this.columnName = columnName;
49         this.tableColumn = (tableName + '.' + columnName);
50     }
51
52     /**
53      * Compares this object with another <code>TableColumn</code>.
54      *
55      * @param obj The object to compare to.
56      */

57     public boolean equals(Object JavaDoc obj)
58     {
59         if (this == obj)
60         {
61             return true;
62         }
63         else if (obj == null)
64         {
65             return false;
66         }
67         else if (obj instanceof TableColumn)
68         {
69             TableColumn tc = (TableColumn) obj;
70             return (tableName.equals(tc.tableName) &&
71                     columnName.equals(tc.columnName));
72         }
73         else
74         {
75             return false;
76         }
77     }
78
79     /**
80      * The concatenation of the table name and column name separated with a
81      * dot.
82      *
83      * @return This object's string representation.
84      */

85     public String JavaDoc toString()
86     {
87         return tableColumn;
88     }
89 }
90
Popular Tags