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 DynamicColumnNameMapping<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 |
---|
DynamicColumnNameMapping(Function<TEntity,String> fetchColumnName,
BiConsumer<String,TEntity> csvToField)
Constructor for read only mappings
|
DynamicColumnNameMapping(Function<TEntity,String> fetchColumnName,
Function<TEntity,TProperty> fieldToCsv,
BiConsumer<String,TEntity> csvToField)
Constructor for mappings both directions
|
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 DynamicColumnNameMapping(Function<TEntity,String> fetchColumnName, BiConsumer<String,TEntity> csvToField)
fetchColumnName
- Function to determine header for data to be stored
atcsvToField
- Function to set the value from CSV on an objectpublic DynamicColumnNameMapping(Function<TEntity,String> fetchColumnName, Function<TEntity,TProperty> fieldToCsv, BiConsumer<String,TEntity> csvToField)
fetchColumnName
- Function to determine header for data to be stored
atfieldToCsv
- Function to get the value from an entitycsvToField
- Function to set the value from CSV on an objectpublic 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.