com.microsoft.bingads.v13.internal.bulk.SimpleBulkMapping 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;
import com.microsoft.bingads.v13.bulk.entities.BulkEntity;
/**
* A simple bulk mapping which translates values from a single field to a single
* column
*
* @param The type of {@link BulkEntity} that the binding is for
* @param The type of the property on the {@link BulkEntity} that is
* being managed by this mapping
*/
public class SimpleBulkMapping extends SingleFieldBulkMapping {
private String csvHeader;
public SimpleBulkMapping(String csvHeader, Function fieldToCsv, BiConsumer csvToField, boolean passNulls) {
super(fieldToCsv, csvToField, passNulls);
this.csvHeader = csvHeader;
}
/**
* Constructor for mappings
*
* @param csvHeader Name of the header
* @param fieldToCsv Function to get the value from an entity
* @param csvToField Function to set the value from CSV on an entity
*/
public SimpleBulkMapping(String csvHeader, Function fieldToCsv, BiConsumer csvToField) {
this(csvHeader, fieldToCsv, csvToField, false);
}
@Override
public String getHeader(TEntity entity) {
return this.csvHeader;
}
}