db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r634935 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java
Date Sat, 08 Mar 2008 11:43:55 GMT
Author: tomdz
Date: Sat Mar  8 03:43:52 2008
New Revision: 634935

URL: http://svn.apache.org/viewvc?rev=634935&view=rev
Log:
Implementation of DDLUTILS-177: Table does not have a getRequiredColumns method

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java?rev=634935&r1=634934&r2=634935&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/model/Table.java Sat Mar  8 03:43:52 2008
@@ -744,10 +744,10 @@
     }
 
     /**
-     * Returns the auto increment columns in this table. If no incrementcolumns
-     * are found, it will return an empty array.
+     * Returns the auto increment columns in this table. If none are found,
+     * then an empty array will be returned.
      * 
-     * @return The columns
+     * @return The auto increment columns
      */
     public Column[] getAutoIncrementColumns()
     {
@@ -758,6 +758,23 @@
         });
 
         return (Column[])autoIncrColumns.toArray(new Column[autoIncrColumns.size()]);
+    }
+
+    /**
+     * Returns the required (not-nullable) columns in this table. If none are found,
+     * then an empty array will be returned.
+     * 
+     * @return The required columns
+     */
+    public Column[] getRequiredColumns()
+    {
+        Collection requiredColumns = CollectionUtils.select(_columns, new Predicate() {
+            public boolean evaluate(Object input) {
+                return ((Column)input).isRequired();
+            }
+        });
+
+        return (Column[])requiredColumns.toArray(new Column[requiredColumns.size()]);
     }
 
     /**



Mime
View raw message