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 a column name.
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 ColumnName extends ColumnTerm {
29: private String name = null;
30:
31: /**
32: * Constructor.
33: * @param name the column name
34: */
35: public ColumnName(String name) {
36: super ();
37: this .name = name;
38: }
39:
40: /**
41: * Compares objects.
42: * @param obj another object.
43: * @return a boolean
44: */
45: public boolean sameAs(Object obj) {
46: if (obj != null && obj instanceof ColumnName) {
47: ColumnName s = (ColumnName) obj;
48: boolean result = name == null ? s.name == null : name
49: .equals(s.name);
50: return result;
51: }
52: return false;
53: }
54:
55: /**
56: * Gather the host variables.
57: * @param variables the list used to collect the variables
58: */
59: public void prepare(java.util.List variables) {
60: // nothing to do here
61: }
62:
63: /**
64: * @return String
65: */
66: public String getName() {
67: return name;
68: }
69:
70: /**
71: * Sets the name.
72: * @param name The name to set
73: */
74: public void setName(String name) {
75: this .name = name;
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(getName());
84: }
85:
86: }
|