01: /*
02: * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package org.mandarax.jdbc.server.sql;
20:
21: /**
22: * Represents the SQL FROM clause with one table.
23: * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
24: * @version 3.3.2 <29 December 2004>
25: * @since 3.0
26: */
27:
28: public class FromClauseOneTable extends FromClause {
29: private String tableName = null;
30:
31: /**
32: * Constructor.
33: */
34: public FromClauseOneTable() {
35: super ();
36: }
37:
38: /**
39: * Constructor.
40: * @param tableName a table name
41: */
42: public FromClauseOneTable(String tableName) {
43: super ();
44: this .tableName = tableName;
45: }
46:
47: /**
48: * Compares objects.
49: * @param obj another object.
50: * @return a boolean
51: */
52: public boolean sameAs(Object obj) {
53: if (obj != null && obj instanceof FromClauseOneTable) {
54: FromClauseOneTable s = (FromClauseOneTable) obj;
55: boolean result = tableName == null ? s.tableName == null
56: : tableName.equals(s.tableName);
57: return result;
58: }
59: return false;
60: }
61:
62: /**
63: * Get the table name.
64: * @return String
65: */
66: public String getTableName() {
67: return tableName;
68: }
69:
70: /**
71: * Sets the tableName.
72: * @param tableName The tableName to set
73: */
74: public void setTableName(String tableName) {
75: this .tableName = tableName;
76: }
77:
78: /**
79: * Print the object on a buffer in order to display the parsed SQL.
80: * @param out a string bufer to print on
81: */
82: public void print(StringBuffer out) {
83: out.append(tableName);
84: }
85:
86: }
|