summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2009-12-23 01:50:52 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2009-12-23 01:50:52 +0000
commitd590fa696b5dd00c73d659a4b0d2c4f7a0c87886 (patch)
tree122b664bcbb651cac0eaedada758e853bace486e /src
parent8c625cfd2cfe8c76e1598daad488939a93d5eb04 (diff)
downloadjackcess-d590fa696b5dd00c73d659a4b0d2c4f7a0c87886.tar.gz
jackcess-d590fa696b5dd00c73d659a4b0d2c4f7a0c87886.zip
minor refactor
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@423 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index f17fd30..0eb9f9c 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -1140,14 +1140,7 @@ public class Table
* 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;
+ return asRow(rowMap, null);
}
/**
@@ -1155,8 +1148,18 @@ public class Table
* appropriate for a call to {@link #updateCurrentRow(Object...)}.
*/
public Object[] asUpdateRow(Map<String,Object> rowMap) {
+ return asRow(rowMap, Column.KEEP_VALUE);
+ }
+
+ /**
+ * Converts a map of columnName -> columnValue to an array of row values.
+ */
+ private Object[] asRow(Map<String,Object> rowMap, Object defaultValue)
+ {
Object[] row = new Object[_columns.size()];
- Arrays.fill(row, Column.KEEP_VALUE);
+ if(defaultValue != null) {
+ Arrays.fill(row, defaultValue);
+ }
if(rowMap == null) {
return row;
}