Implementation of DDLUTILS-177: Table does not have a getRequiredColumns method

git-svn-id: https://svn.apache.org/repos/asf/db/ddlutils/trunk@634935 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/ddlutils/model/Table.java b/src/java/org/apache/ddlutils/model/Table.java
index f589a7d..447696b 100644
--- a/src/java/org/apache/ddlutils/model/Table.java
+++ b/src/java/org/apache/ddlutils/model/Table.java
@@ -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()
     {
@@ -761,6 +761,23 @@
     }
 
     /**
+     * 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()]);
+    }
+
+    /**
      * Sorts the foreign keys alphabetically.
      * 
      * @param caseSensitive Whether case matters