com.microsoft.bingads.v13.internal.bulk.ConditionalBulkMapping 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;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
public class ConditionalBulkMapping implements BulkMapping {
private SimpleBulkMapping simpleMapping;
private Function condition;
public ConditionalBulkMapping(String csvHeader, Function condition, Function fieldToCsv, BiConsumer csvToField) {
simpleMapping = new SimpleBulkMapping(csvHeader, fieldToCsv, csvToField);
this.condition = condition;
}
@Override
public void convertToCsv(TEntity entity, RowValues values) {
if (condition.apply(entity)) {
simpleMapping.convertToCsv(entity, values);
}
}
@Override
public void convertToEntity(RowValues values, TEntity entity) {
if (condition.apply(entity)) {
simpleMapping.convertToEntity(values, entity);
}
}
}