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

com.microsoft.bingads.v10.bulk.entities.BulkLocationTargetBidWithStringLocation 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.23.2
Show newest version
package com.microsoft.bingads.v10.bulk.entities;

import com.microsoft.bingads.v10.bulk.entities.BulkTargetIdentifier;
import com.microsoft.bingads.v10.internal.bulk.StringExtensions;
import com.microsoft.bingads.v10.internal.bulk.StringTable;
import com.microsoft.bingads.v10.internal.bulk.BulkMapping;
import com.microsoft.bingads.v10.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v10.internal.bulk.RowValues;
import com.microsoft.bingads.v10.internal.bulk.SimpleBulkMapping;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import com.microsoft.bingads.internal.functionalinterfaces.Function;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * This abstract base class provides properties that are shared by
 * all bulk location target bid classes defining Location as string.
 */
abstract class BulkLocationTargetBidWithStringLocation extends BulkTargetBid {

    private String location;

    private LocationTargetType locationType;

    /**
     * Reserved for internal use.
     */
    BulkLocationTargetBidWithStringLocation(BulkTargetIdentifier identifier) {
        super(identifier);
    }

    private static final List> MAPPINGS;

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

        m.add(new SimpleBulkMapping(StringTable.Target,
                new Function() {
                    @Override
                    public String apply(BulkLocationTargetBidWithStringLocation c) {
                        return c.getLocation();
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkLocationTargetBidWithStringLocation c) {
                        c.setLocation(v);
                    }
                }
        ));

        m.add(new SimpleBulkMapping(StringTable.SubType,
                new Function() {
                    @Override
                    public String apply(BulkLocationTargetBidWithStringLocation c) {
                        return StringExtensions.toLocationTargetTypeBulkString(c.getLocationType());
                    }
                },
                new BiConsumer() {
                    @Override
                    public void accept(String v, BulkLocationTargetBidWithStringLocation c) {
                        c.setLocationType(StringExtensions.parseLocationTargetType(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);
    }

    /**
     * Gets the geographical location code.
     *
     * 

* Corresponds to the 'Target' field in the bulk file. *

*/ public String getLocation() { return location; } /** * Sets the geographical location code. * *

* Corresponds to the 'Target' field in the bulk file. *

*/ public void setLocation(String location) { this.location = location; } /** * Gets the sub location target type. * *

* Corresponds to the 'Sub Type' field in the bulk file. *

*/ public LocationTargetType getLocationType() { return locationType; } /** * Sets the sub location target type. * *

* Corresponds to the 'Sub Type' field in the bulk file. *

*/ public void setLocationType(LocationTargetType locationType) { this.locationType = locationType; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy