All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.bingads.v13.internal.bulk.ConditionalBulkMapping Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 13.0.22.1
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy