Browse Source

minor refactor

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@423 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-1.1.21
James Ahlborn 14 years ago
parent
commit
d590fa696b
1 changed files with 12 additions and 9 deletions
  1. 12
    9
      src/java/com/healthmarketscience/jackcess/Table.java

+ 12
- 9
src/java/com/healthmarketscience/jackcess/Table.java View File

@@ -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;
}

Loading…
Cancel
Save