ColumnName.java :  » Rule-Engine » Mandarax » org » mandarax » jdbc » server » sql » Java Open Source

Java Open Source » Rule Engine » Mandarax 
Mandarax » org » mandarax » jdbc » server » sql » ColumnName.java
/*
 * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.mandarax.jdbc.server.sql;

/**
 * Represents a column name.
 * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
 * @version 3.3.2 <29 December 2004>
 * @since 3.0
 */

public class ColumnName extends ColumnTerm {
  private String name = null;
  /**
   * Constructor.
   * @param name the column name
   */
  public ColumnName(String name) {
    super();
    this.name = name;
  }
  /**
  * Compares objects. 
  * @param obj another object.
  * @return a boolean
  */
  public boolean sameAs(Object obj) {
    if (obj != null && obj instanceof ColumnName) {
      ColumnName s = (ColumnName) obj;
      boolean result = name == null ? s.name == null : name.equals(s.name);
      return result;
    }
    return false;
  }
  /**
    * Gather the host variables.
    * @param variables the list used to collect the variables
    */
  public void prepare(java.util.List variables) {
    // nothing to do here
  }

  /**
   * @return String
   */
  public String getName() {
    return name;
  }

  /**
   * Sets the name.
   * @param name The name to set
   */
  public void setName(String name) {
    this.name = name;
  }
  /**
   * Print the object on a buffer in order to display the parsed SQL.
   * @param out a string bufer to print on
   */
  public void print(StringBuffer out) {
    out.append(getName());
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.