TEntity
- The type of BulkEntity
that the binding is forTProperty
- The type of the property on the BulkEntity
that is
being managed by this mappingpublic class SimpleBulkMapping<TEntity,TProperty> extends Object
Modifier and Type | Field and Description |
---|---|
protected Function<TProperty,String> |
bulkToString |
protected BiConsumer<String,TEntity> |
csvToField |
protected Function<TEntity,TProperty> |
fieldToCsv |
Constructor and Description |
---|
SimpleBulkMapping(String csvHeader,
Function<TEntity,TProperty> fieldToCsv,
BiConsumer<String,TEntity> csvToField)
Constructor for mappings
|
SimpleBulkMapping(String csvHeader,
Function<TEntity,TProperty> fieldToCsv,
BiConsumer<String,TEntity> csvToField,
boolean passNulls) |
Modifier and Type | Method and Description |
---|---|
void |
convertToCsv(TEntity entity,
RowValues values)
Moves a value from an object to a column in the CSV
|
void |
convertToEntity(RowValues values,
TEntity entity)
Moves a value from csv column to a field on an entity
|
String |
getHeader(TEntity entity) |
protected Function<TEntity,TProperty> fieldToCsv
protected BiConsumer<String,TEntity> csvToField
public SimpleBulkMapping(String csvHeader, Function<TEntity,TProperty> fieldToCsv, BiConsumer<String,TEntity> csvToField, boolean passNulls)
public SimpleBulkMapping(String csvHeader, Function<TEntity,TProperty> fieldToCsv, BiConsumer<String,TEntity> csvToField)
csvHeader
- Name of the headerfieldToCsv
- Function to get the value from an entitycsvToField
- Function to set the value from CSV on an entitypublic String getHeader(TEntity entity)
entity
- A BulkEntity
containing datapublic void convertToEntity(RowValues values, TEntity entity)
BulkMapping
convertToEntity
in interface BulkMapping<TEntity>
values
- CSV valuesentity
- entity to modifypublic void convertToCsv(TEntity entity, RowValues values)
BulkMapping
convertToCsv
in interface BulkMapping<TEntity>
entity
- entity to pull value fromvalues
- CSV columns data to modifyCopyright © 2024. All rights reserved.