com.microsoft.bingads.v13.internal.bulk.ComplexBulkMapping Maven / Gradle / Ivy
package com.microsoft.bingads.v13.internal.bulk;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
/**
* A bulk mapping with which to do complex transformation usually involving more
* than one field
*
* @param
*/
public class ComplexBulkMapping implements BulkMapping {
private BiConsumer entityToCsv;
private BiConsumer csvToEntity;
/**
* @param entityToCsv Function describing reading an entity and setting the
* appropriate columns
* @param csvToEntity Function describes getting values from CSV columns and
* setting the correct values on
*/
public ComplexBulkMapping(BiConsumer entityToCsv,
BiConsumer csvToEntity) {
this.entityToCsv = entityToCsv;
this.csvToEntity = csvToEntity;
}
/**
* Calls the custom function provided for csv to entity translation
*/
@Override
public void convertToEntity(RowValues values, TEntity entity) {
this.csvToEntity.accept(values, entity);
}
/**
* Calls the custom function provided for entity to csv translation
*/
@Override
public void convertToCsv(TEntity entity, RowValues values) {
if (this.entityToCsv == null) {
return; //This mapping is read only
}
this.entityToCsv.accept(entity, values);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy