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

com.microsoft.bingads.v13.internal.bulk.ComplexBulkMapping 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;

/**
 * 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 - 2024 Weber Informatics LLC | Privacy Policy