com.microsoft.bingads.v13.bulk.entities.BulkResponsiveSearchAd 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.bulk.entities;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
import com.microsoft.bingads.v13.bulk.BulkFileReader;
import com.microsoft.bingads.v13.bulk.BulkFileWriter;
import com.microsoft.bingads.v13.bulk.BulkOperation;
import com.microsoft.bingads.v13.bulk.BulkServiceManager;
import com.microsoft.bingads.v13.campaignmanagement.AdType;
import com.microsoft.bingads.v13.campaignmanagement.ResponsiveSearchAd;
import com.microsoft.bingads.v13.internal.bulk.BulkMapping;
import com.microsoft.bingads.v13.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v13.internal.bulk.RowValues;
import com.microsoft.bingads.v13.internal.bulk.SimpleBulkMapping;
import com.microsoft.bingads.v13.internal.bulk.StringExtensions;
import com.microsoft.bingads.v13.internal.bulk.StringTable;
/**
* Represents a Responsive Search ad.
*
* This class exposes the {@link #setResponsiveSearchAd} and {@link #getResponsiveSearchAd} methods
* that can be used to read and write fields of the Responsive Search Ad record in a bulk file.
*
*
* For more information, see Responsive Search Ad at
* https://go.microsoft.com/fwlink/?linkid=846127.
*
*
* @see BulkServiceManager
* @see BulkOperation
* @see BulkFileReader
* @see BulkFileWriter
*/
public class BulkResponsiveSearchAd extends BulkAd {
private static final List> MAPPINGS;
static {
List> m = new ArrayList>();
m.add(new SimpleBulkMapping(StringTable.Path1,
new Function() {
@Override
public String apply(BulkResponsiveSearchAd c) {
return StringExtensions.toOptionalBulkString(c.getAd().getPath1(), c.getAd().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkResponsiveSearchAd c) {
c.getAd().setPath1(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.Path2,
new Function() {
@Override
public String apply(BulkResponsiveSearchAd c) {
return StringExtensions.toOptionalBulkString(c.getAd().getPath2(), c.getAd().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkResponsiveSearchAd c) {
c.getAd().setPath2(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.Domain,
new Function() {
@Override
public String apply(BulkResponsiveSearchAd c) {
return StringExtensions.toOptionalBulkString(c.getAd().getDomain(), c.getAd().getId());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkResponsiveSearchAd c) {
c.getAd().setDomain(StringExtensions.getValueOrEmptyString(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.Headline,
new Function() {
@Override
public String apply(BulkResponsiveSearchAd c) {
return StringExtensions.toTextAssetLinksBulkString(c.getAd().getHeadlines());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkResponsiveSearchAd c) {
c.getAd().setHeadlines(StringExtensions.parseTextAssetLinks(v));
}
}
));
m.add(new SimpleBulkMapping(StringTable.Description,
new Function() {
@Override
public String apply(BulkResponsiveSearchAd c) {
return StringExtensions.toTextAssetLinksBulkString(c.getAd().getDescriptions());
}
},
new BiConsumer() {
@Override
public void accept(String v, BulkResponsiveSearchAd c) {
c.getAd().setDescriptions(StringExtensions.parseTextAssetLinks(v));
}
}
));
MAPPINGS = Collections.unmodifiableList(m);
}
@Override
public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) {
validatePropertyNotNull(getResponsiveSearchAd(), "ResponsiveSearchAd");
super.processMappingsToRowValues(values, excludeReadonlyData);
MappingHelpers.convertToValues(this, values, MAPPINGS);
}
@Override
public void processMappingsFromRowValues(RowValues values) {
setAd(new ResponsiveSearchAd());
getAd().setType(AdType.RESPONSIVE_SEARCH);
super.processMappingsFromRowValues(values);
MappingHelpers.convertToEntity(values, MAPPINGS, this);
}
/**
* Gets the product ad.
*/
public ResponsiveSearchAd getResponsiveSearchAd() {
return ad;
}
/**
* Sets the product ad.
*/
public void setResponsiveSearchAd(ResponsiveSearchAd ad) {
this.setAd(ad);
}
}