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

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

There is a newer version: 17.12.0
Show newest version

package com.commercetools.history.models.common;

import java.util.*;
import java.util.function.Function;

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

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

 *     ItemShippingDetails itemShippingDetails = ItemShippingDetails.builder()
 *             .plusTargets(targetsBuilder -> targetsBuilder)
 *             .valid(true)
 *             .build()
 * 
*
*/ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") public class ItemShippingDetailsBuilder implements Builder { private java.util.List targets; private Boolean valid; /** * set values to the targets * @param targets value to be set * @return Builder */ public ItemShippingDetailsBuilder targets( final com.commercetools.history.models.common.ItemShippingTarget... targets) { this.targets = new ArrayList<>(Arrays.asList(targets)); return this; } /** * set value to the targets * @param targets value to be set * @return Builder */ public ItemShippingDetailsBuilder targets( final java.util.List targets) { this.targets = targets; return this; } /** * add values to the targets * @param targets value to be set * @return Builder */ public ItemShippingDetailsBuilder plusTargets( final com.commercetools.history.models.common.ItemShippingTarget... targets) { if (this.targets == null) { this.targets = new ArrayList<>(); } this.targets.addAll(Arrays.asList(targets)); return this; } /** * add the value to the targets using the builder function * @param builder function to build the targets value * @return Builder */ public ItemShippingDetailsBuilder plusTargets( Function builder) { if (this.targets == null) { this.targets = new ArrayList<>(); } this.targets.add(builder.apply(com.commercetools.history.models.common.ItemShippingTargetBuilder.of()).build()); return this; } /** * set the value to the targets using the builder function * @param builder function to build the targets value * @return Builder */ public ItemShippingDetailsBuilder withTargets( Function builder) { this.targets = new ArrayList<>(); this.targets.add(builder.apply(com.commercetools.history.models.common.ItemShippingTargetBuilder.of()).build()); return this; } /** * add the value to the targets using the builder function * @param builder function to build the targets value * @return Builder */ public ItemShippingDetailsBuilder addTargets( Function builder) { return plusTargets(builder.apply(com.commercetools.history.models.common.ItemShippingTargetBuilder.of())); } /** * set the value to the targets using the builder function * @param builder function to build the targets value * @return Builder */ public ItemShippingDetailsBuilder setTargets( Function builder) { return targets(builder.apply(com.commercetools.history.models.common.ItemShippingTargetBuilder.of())); } /** *

true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in targets, false otherwise. A cart cannot be ordered when the value is false. The error InvalidItemShippingDetails will be triggered.

* @param valid value to be set * @return Builder */ public ItemShippingDetailsBuilder valid(final Boolean valid) { this.valid = valid; return this; } /** * value of targets} * @return targets */ public java.util.List getTargets() { return this.targets; } /** *

true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in targets, false otherwise. A cart cannot be ordered when the value is false. The error InvalidItemShippingDetails will be triggered.

* @return valid */ public Boolean getValid() { return this.valid; } /** * builds ItemShippingDetails with checking for non-null required values * @return ItemShippingDetails */ public ItemShippingDetails build() { Objects.requireNonNull(targets, ItemShippingDetails.class + ": targets is missing"); Objects.requireNonNull(valid, ItemShippingDetails.class + ": valid is missing"); return new ItemShippingDetailsImpl(targets, valid); } /** * builds ItemShippingDetails without checking for non-null required values * @return ItemShippingDetails */ public ItemShippingDetails buildUnchecked() { return new ItemShippingDetailsImpl(targets, valid); } /** * factory method for an instance of ItemShippingDetailsBuilder * @return builder */ public static ItemShippingDetailsBuilder of() { return new ItemShippingDetailsBuilder(); } /** * create builder for ItemShippingDetails instance * @param template instance with prefilled values for the builder * @return builder */ public static ItemShippingDetailsBuilder of(final ItemShippingDetails template) { ItemShippingDetailsBuilder builder = new ItemShippingDetailsBuilder(); builder.targets = template.getTargets(); builder.valid = template.getValid(); return builder; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy