com.microsoft.bingads.v13.internal.bulk.ComplexBulkMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft.bingads Show documentation
Show all versions of microsoft.bingads Show documentation
The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.
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);
}
}