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

com.microsoft.bingads.v13.bulk.entities.BulkEntityNegativeKeyword 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.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.internal.bulk.BulkMapping;
import com.microsoft.bingads.v13.internal.bulk.DynamicColumnNameMapping;
import com.microsoft.bingads.v13.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v13.internal.bulk.RowValues;

/**
 * This abstract base class for all bulk negative keywords that are assigned individually to a campaign or ad group entity.
 *
 * @see BulkAdGroupNegativeKeyword
 * @see BulkCampaignNegativeKeyword
 */
abstract class BulkEntityNegativeKeyword extends BulkNegativeKeyword {

    private String entityName;

    private static final List> MAPPINGS;

    static {
        List> m = new ArrayList>();

        m.add(new DynamicColumnNameMapping(
                new Function() {
                    @Override
                    public String apply(BulkEntityNegativeKeyword c) {
                        return c.getEntityColumnName();
                    }
                },
                new Function() {
                    @Override
                    public String apply(BulkEntityNegativeKeyword c) {
                        return c.getEntityName();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkEntityNegativeKeyword c) {
                        c.setEntityName(v);
                    }
                }
        ));

        MAPPINGS = Collections.unmodifiableList(m);
    }

    @Override
    public void processMappingsFromRowValues(RowValues values) {
        super.processMappingsFromRowValues(values);

        MappingHelpers.convertToEntity(values, MAPPINGS, this);
    }

    @Override
    public void processMappingsToRowValues(RowValues values, boolean excludeReadonlyData) {
        super.processMappingsToRowValues(values, excludeReadonlyData);

        MappingHelpers.convertToValues(this, values, MAPPINGS);
    }

    /**
     * Reserved for internal use.
     */
    String getEntityName() {
        return entityName;
    }

    /**
     * Reserved for internal use.
     */
    void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    /**
     * Reserved for internal use.
     */
    abstract String getEntityColumnName();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy