com.commercetools.history.models.change.ChangeLineItemQuantityChangeBuilder 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;
import java.util.*;
import java.util.function.Function;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* ChangeLineItemQuantityChangeBuilder
*
* Example to create an instance using the builder pattern
*
*
* ChangeLineItemQuantityChange changeLineItemQuantityChange = ChangeLineItemQuantityChange.builder()
* .change("{change}")
* .previousValue(1)
* .nextValue(1)
* .lineItem(lineItemBuilder -> lineItemBuilder)
* .lineItemId("{lineItemId}")
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ChangeLineItemQuantityChangeBuilder implements Builder {
private String change;
private Integer previousValue;
private Integer nextValue;
private com.commercetools.history.models.common.LocalizedString lineItem;
private String lineItemId;
/**
* set the value to the change
* @param change value to be set
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder change(final String change) {
this.change = change;
return this;
}
/**
* Value before the change.
* @param previousValue value to be set
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder previousValue(final Integer previousValue) {
this.previousValue = previousValue;
return this;
}
/**
* Value after the change
* @param nextValue value to be set
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder nextValue(final Integer nextValue) {
this.nextValue = nextValue;
return this;
}
/**
* Name of the Product the updated Line Item is based on.
* @param builder function to build the lineItem value
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder lineItem(
Function builder) {
this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build();
return this;
}
/**
* Name of the Product the updated Line Item is based on.
* @param builder function to build the lineItem value
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder withLineItem(
Function builder) {
this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of());
return this;
}
/**
* Name of the Product the updated Line Item is based on.
* @param lineItem value to be set
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder lineItem(
final com.commercetools.history.models.common.LocalizedString lineItem) {
this.lineItem = lineItem;
return this;
}
/**
* id
of the updated LineItem.
* @param lineItemId value to be set
* @return Builder
*/
public ChangeLineItemQuantityChangeBuilder lineItemId(final String lineItemId) {
this.lineItemId = lineItemId;
return this;
}
/**
* value of change}
* @return change
*/
public String getChange() {
return this.change;
}
/**
* Value before the change.
* @return previousValue
*/
public Integer getPreviousValue() {
return this.previousValue;
}
/**
* Value after the change
* @return nextValue
*/
public Integer getNextValue() {
return this.nextValue;
}
/**
* Name of the Product the updated Line Item is based on.
* @return lineItem
*/
public com.commercetools.history.models.common.LocalizedString getLineItem() {
return this.lineItem;
}
/**
* id
of the updated LineItem.
* @return lineItemId
*/
public String getLineItemId() {
return this.lineItemId;
}
/**
* builds ChangeLineItemQuantityChange with checking for non-null required values
* @return ChangeLineItemQuantityChange
*/
public ChangeLineItemQuantityChange build() {
Objects.requireNonNull(change, ChangeLineItemQuantityChange.class + ": change is missing");
Objects.requireNonNull(previousValue, ChangeLineItemQuantityChange.class + ": previousValue is missing");
Objects.requireNonNull(nextValue, ChangeLineItemQuantityChange.class + ": nextValue is missing");
Objects.requireNonNull(lineItem, ChangeLineItemQuantityChange.class + ": lineItem is missing");
Objects.requireNonNull(lineItemId, ChangeLineItemQuantityChange.class + ": lineItemId is missing");
return new ChangeLineItemQuantityChangeImpl(change, previousValue, nextValue, lineItem, lineItemId);
}
/**
* builds ChangeLineItemQuantityChange without checking for non-null required values
* @return ChangeLineItemQuantityChange
*/
public ChangeLineItemQuantityChange buildUnchecked() {
return new ChangeLineItemQuantityChangeImpl(change, previousValue, nextValue, lineItem, lineItemId);
}
/**
* factory method for an instance of ChangeLineItemQuantityChangeBuilder
* @return builder
*/
public static ChangeLineItemQuantityChangeBuilder of() {
return new ChangeLineItemQuantityChangeBuilder();
}
/**
* create builder for ChangeLineItemQuantityChange instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static ChangeLineItemQuantityChangeBuilder of(final ChangeLineItemQuantityChange template) {
ChangeLineItemQuantityChangeBuilder builder = new ChangeLineItemQuantityChangeBuilder();
builder.change = template.getChange();
builder.previousValue = template.getPreviousValue();
builder.nextValue = template.getNextValue();
builder.lineItem = template.getLineItem();
builder.lineItemId = template.getLineItemId();
return builder;
}
}