com.commercetools.history.models.change_value.ChangeValueAbsoluteChangeValueBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-history Show documentation
Show all versions of commercetools-sdk-java-history Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.history.models.change_value;
import java.util.*;
import java.util.function.Function;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* ChangeValueAbsoluteChangeValueBuilder
*
* Example to create an instance using the builder pattern
*
*
* ChangeValueAbsoluteChangeValue changeValueAbsoluteChangeValue = ChangeValueAbsoluteChangeValue.builder()
* .plusMoney(moneyBuilder -> moneyBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ChangeValueAbsoluteChangeValueBuilder implements Builder {
private java.util.List money;
/**
* Money values in different currencies.
* @param money value to be set
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder money(final com.commercetools.history.models.common.Money... money) {
this.money = new ArrayList<>(Arrays.asList(money));
return this;
}
/**
* Money values in different currencies.
* @param money value to be set
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder money(
final java.util.List money) {
this.money = money;
return this;
}
/**
* Money values in different currencies.
* @param money value to be set
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder plusMoney(
final com.commercetools.history.models.common.Money... money) {
if (this.money == null) {
this.money = new ArrayList<>();
}
this.money.addAll(Arrays.asList(money));
return this;
}
/**
* Money values in different currencies.
* @param builder function to build the money value
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder plusMoney(
Function builder) {
if (this.money == null) {
this.money = new ArrayList<>();
}
this.money.add(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()).build());
return this;
}
/**
* Money values in different currencies.
* @param builder function to build the money value
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder withMoney(
Function builder) {
this.money = new ArrayList<>();
this.money.add(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()).build());
return this;
}
/**
* Money values in different currencies.
* @param builder function to build the money value
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder addMoney(
Function builder) {
return plusMoney(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()));
}
/**
* Money values in different currencies.
* @param builder function to build the money value
* @return Builder
*/
public ChangeValueAbsoluteChangeValueBuilder setMoney(
Function builder) {
return money(builder.apply(com.commercetools.history.models.common.MoneyBuilder.of()));
}
/**
* Money values in different currencies.
* @return money
*/
public java.util.List getMoney() {
return this.money;
}
/**
* builds ChangeValueAbsoluteChangeValue with checking for non-null required values
* @return ChangeValueAbsoluteChangeValue
*/
public ChangeValueAbsoluteChangeValue build() {
Objects.requireNonNull(money, ChangeValueAbsoluteChangeValue.class + ": money is missing");
return new ChangeValueAbsoluteChangeValueImpl(money);
}
/**
* builds ChangeValueAbsoluteChangeValue without checking for non-null required values
* @return ChangeValueAbsoluteChangeValue
*/
public ChangeValueAbsoluteChangeValue buildUnchecked() {
return new ChangeValueAbsoluteChangeValueImpl(money);
}
/**
* factory method for an instance of ChangeValueAbsoluteChangeValueBuilder
* @return builder
*/
public static ChangeValueAbsoluteChangeValueBuilder of() {
return new ChangeValueAbsoluteChangeValueBuilder();
}
/**
* create builder for ChangeValueAbsoluteChangeValue instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static ChangeValueAbsoluteChangeValueBuilder of(final ChangeValueAbsoluteChangeValue template) {
ChangeValueAbsoluteChangeValueBuilder builder = new ChangeValueAbsoluteChangeValueBuilder();
builder.money = template.getMoney();
return builder;
}
}