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

com.commercetools.history.models.common.ItemShippingTargetBuilder Maven / Gradle / Ivy

There is a newer version: 17.15.1
Show newest version

package com.commercetools.history.models.common;

import java.util.*;

import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;

/**
 * ItemShippingTargetBuilder
 * 
* Example to create an instance using the builder pattern *
*

 *     ItemShippingTarget itemShippingTarget = ItemShippingTarget.builder()
 *             .addressKey("{addressKey}")
 *             .quantity(1)
 *             .build()
 * 
*
*/ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") public class ItemShippingTargetBuilder implements Builder { private String addressKey; private Integer quantity; /** *

The key of the address in the cart's itemShippingAddresses

* @param addressKey value to be set * @return Builder */ public ItemShippingTargetBuilder addressKey(final String addressKey) { this.addressKey = addressKey; return this; } /** *

The quantity of items that should go to the address with the specified addressKey. Only positive values are allowed. Using 0 as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.

* @param quantity value to be set * @return Builder */ public ItemShippingTargetBuilder quantity(final Integer quantity) { this.quantity = quantity; return this; } /** *

The key of the address in the cart's itemShippingAddresses

* @return addressKey */ public String getAddressKey() { return this.addressKey; } /** *

The quantity of items that should go to the address with the specified addressKey. Only positive values are allowed. Using 0 as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails.

* @return quantity */ public Integer getQuantity() { return this.quantity; } /** * builds ItemShippingTarget with checking for non-null required values * @return ItemShippingTarget */ public ItemShippingTarget build() { Objects.requireNonNull(addressKey, ItemShippingTarget.class + ": addressKey is missing"); Objects.requireNonNull(quantity, ItemShippingTarget.class + ": quantity is missing"); return new ItemShippingTargetImpl(addressKey, quantity); } /** * builds ItemShippingTarget without checking for non-null required values * @return ItemShippingTarget */ public ItemShippingTarget buildUnchecked() { return new ItemShippingTargetImpl(addressKey, quantity); } /** * factory method for an instance of ItemShippingTargetBuilder * @return builder */ public static ItemShippingTargetBuilder of() { return new ItemShippingTargetBuilder(); } /** * create builder for ItemShippingTarget instance * @param template instance with prefilled values for the builder * @return builder */ public static ItemShippingTargetBuilder of(final ItemShippingTarget template) { ItemShippingTargetBuilder builder = new ItemShippingTargetBuilder(); builder.addressKey = template.getAddressKey(); builder.quantity = template.getQuantity(); return builder; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy