diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/Table.java | 15 |
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 |