com.microsoft.bingads.v13.internal.bulk.ConditionalBulkMapping Maven / Gradle / Ivy
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);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy