You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by dl...@apache.org on 2001/03/19 23:02:48 UTC
cvs commit: jakarta-turbine/src/java/org/apache/turbine/torque/engine/database/model Table.java
dlr 01/03/19 14:02:48
Modified: src/java/org/apache/turbine/torque/engine/database/model
Table.java
Log:
* Deprecated getPrimaryKeys() and printPrimaryKeys() in favor of the
names getPrimaryKey() and printPrimaryKey(). The fact that a Table's
primary key is made up of multiple parts does not mean that the Table
has more than one primary key. Thus, the plurality of the previous
names was incorrect.
* Enhanced JavaDoc of getPrimaryKey() and printPrimaryKey().
Revision Changes Path
1.4 +34 -16 jakarta-turbine/src/java/org/apache/turbine/torque/engine/database/model/Table.java
Index: Table.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/torque/engine/database/model/Table.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Table.java 2001/03/06 06:13:10 1.3
+++ Table.java 2001/03/19 22:02:47 1.4
@@ -69,7 +69,7 @@
*
* @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Table.java,v 1.3 2001/03/06 06:13:10 chrise Exp $
+ * @version $Id: Table.java,v 1.4 2001/03/19 22:02:47 dlr Exp $
*/
public class Table
{
@@ -599,39 +599,50 @@
}
/**
- * returns a collection of Columns which make up the Primary
- * Key for the table.
+ * Returns the collection of Columns which make up the single primary
+ * key for this table.
+ *
+ * @return A list of the primary key parts.
*/
- public ArrayList getPrimaryKeys()
+ public List getPrimaryKey()
{
- ArrayList pks = new ArrayList(columnVector.size());
- Enumeration enum = columnVector.elements();
+ List pk = new ArrayList(columnVector.size());
- while (enum.hasMoreElements())
+ Iterator iter = columnVector.iterator();
+ while (iter.hasNext())
{
- Column col = (Column)enum.nextElement();
+ Column col = (Column)iter.next();
if (col.isPrimaryKey())
{
- pks.add(col);
+ pk.add(col);
}
}
- return pks;
+ return pk;
}
/**
- * Print the primary key(s) with commas between them.
+ * @deprecated Use getPrimaryKey() instead.
*/
- public String printPrimaryKeys()
+ public final List getPrimaryKeys()
{
+ return getPrimaryKey();
+ }
+
+ /**
+ * Returns all parts of the primary key, separated by commas.
+ *
+ * @return A CSV list of primary key parts.
+ */
+ public String printPrimaryKey()
+ {
StringBuffer result = new StringBuffer();
boolean comma=false;
- Enumeration enum = columnVector.elements();
-
- while (enum.hasMoreElements())
+ Iterator iter = columnVector.iterator();
+ while (iter.hasNext())
{
- Column col = (Column)enum.nextElement();
+ Column col = (Column)iter.next();
if (col.isPrimaryKey())
{
if (comma) result.append (','); else comma=true;
@@ -642,4 +653,11 @@
return result.toString();
}
+ /**
+ * @deprecated Use printPrimaryKey() instead.
+ */
+ public final String printPrimaryKeys()
+ {
+ return printPrimaryKey();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org