Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

TableColumn.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Emmanuel Cecchet.
00022  * Contributor(s): Mathieu Peltier.
00023  */
00024 
00025 package org.objectweb.cjdbc.common.sql.schema;
00026 
00027 /**
00028  * A <code>TableColumn</code> is used to carry parsing information and
00029  * contains a database table name and one of its column.
00030  * 
00031  * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
00032  * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier</a>
00033  * @version 1.0
00034  */
00035 public class TableColumn
00036 {
00037   /** The table name. */
00038   private String tableName;
00039 
00040   /** The column name. */
00041   private String columnName;
00042 
00043   /**
00044    * Creates a new <code>TableColumn</code>.
00045    * 
00046    * @param tableName the table name
00047    * @param columnName the column name
00048    */
00049   public TableColumn(String tableName, String columnName)
00050   {
00051     if (tableName == null)
00052       throw new IllegalArgumentException("Illegal null table name in TableColumn constructor");
00053 
00054     if (columnName == null)
00055       throw new IllegalArgumentException("Illegal null column name in TableColumn constructor");
00056 
00057     this.tableName = tableName;
00058     this.columnName = columnName;
00059   }
00060 
00061   /**
00062    * Returns the column name.
00063    * 
00064    * @return the column name.
00065    */
00066   public String getColumnName()
00067   {
00068     return columnName;
00069   }
00070 
00071   /**
00072    * Returns the table name.
00073    * 
00074    * @return the table name.
00075    */
00076   public String getTableName()
00077   {
00078     return tableName;
00079   }
00080 
00081   /**
00082    * Sets the column name.
00083    * 
00084    * @param columnName the column to set
00085    */
00086   public void setColumnName(String columnName)
00087   {
00088     this.columnName = columnName;
00089   }
00090 
00091   /**
00092    * Sets the table name.
00093    * 
00094    * @param tableName the table to set
00095    */
00096   public void setTableName(String tableName)
00097   {
00098     this.tableName = tableName;
00099   }
00100 
00101   /**
00102    * Two <code>TableColumn</code> objects are considered equal if they have
00103    * the same name and belong to the same table.
00104    * 
00105    * @param other the object to compare with
00106    * @return true if the 2 objects are the same
00107    */
00108   public boolean equals(Object other)
00109   {
00110     if ((other == null) || !(other instanceof TableColumn))
00111       return false;
00112 
00113     TableColumn c = (TableColumn) other;
00114     return columnName.equals(c.getColumnName())
00115       && tableName.equals(c.getTableName());
00116   }
00117 }

Generated on Mon Apr 11 22:01:35 2005 for C-JDBC by  doxygen 1.3.9.1