Class ObjectRowMapper
The ObjectRowMapper maps between an Object or Map to a Row and vice-versa.
The Table will implicitly build an ObjectRowMapper if it's identifierName is set,
and the columns' propertyName is set
Example
var person = {id:1, name:"John Smith", email:"john.smith@mail.com"};
var mapper = new ObjectRowMapper();
mapper.mapIdentifier("id");
mapper.mapProperty(0, "name"); //Column 0 is the name
mapper.mapProperty(1, "email"); //Column 1 is the e-mail
var row = mapper.toRow(person);
table.addRow(row);
Methods
mapIdentifier |
Sets what object property will generate the row identifier |
mapProperty |
Sets what object property will generate the row data for the specified column |
toMap |
Build a Map that represents the row |
toObject |
Build an object that represents the row |
toRow |
Build a Rowthat represents the object or Map |
Methods
|
mapIdentifier
Sets what object property will generate the row identifier Arguments
Name |
Type |
Default |
Description |
name |
String |
|
The row identifier property name |
|
|
mapProperty
Sets what object property will generate the row data for the specified column Arguments
Name |
Type |
Default |
Description |
columnIndex |
Numeric |
|
The column index |
name |
String |
|
The object property name that will generate the column value |
|
|
toMap
Build a Map that represents the row Arguments
Name |
Type |
Default |
Description |
row |
Row |
|
The row |
|
|
toObject
Build an object that represents the row Arguments
Name |
Type |
Default |
Description |
row |
Row |
|
The row |
|
|
toRow
Build a Rowthat represents the object or Map Arguments
Name |
Type |
Default |
Description |
object |
Object or Map |
|
The object or Map |
|