summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-03-10 18:03:45 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-03-10 18:03:45 +0000
commitc7d0f58880d7abd80b8f572903f29636eb6c1181 (patch)
tree6bf39ff6f3bcb66b56483d1efa32262c632b8b62 /src
parent21a6a87655cb76da2f42dad0723ad93d4f03c0dd (diff)
downloadjackcess-c7d0f58880d7abd80b8f572903f29636eb6c1181.tar.gz
jackcess-c7d0f58880d7abd80b8f572903f29636eb6c1181.zip
add convenience method for converting a rowMap to an array of row values
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@263 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 8d09f8b..eeea925 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -1039,6 +1039,21 @@ public class Table
// up-to-date
++_modCount;
}
+
+ /**
+ * Converts a map of columnName -> columnValue to an array of row values
+ * appropriate for a call to {@link #addRow(Object...)}.
+ */
+ public Object[] asRow(Map<String,Object> rowMap) {
+ Object[] row = new Object[_columns.size()];
+ if(rowMap == null) {
+ return row;
+ }
+ for(Column col : _columns) {
+ row[col.getColumnIndex()] = rowMap.get(col.getName());
+ }
+ return row;
+ }
/**
* Add a single row to this table and write it to disk