com.commercetools.history.models.change.RemoveAddressChangeBuilder 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;
/**
* RemoveAddressChangeBuilder
*
* Example to create an instance using the builder pattern
*
*
* RemoveAddressChange removeAddressChange = RemoveAddressChange.builder()
* .change("{change}")
* .previousValue(previousValueBuilder -> previousValueBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class RemoveAddressChangeBuilder implements Builder {
private String change;
private com.commercetools.history.models.common.Address previousValue;
/**
* set the value to the change
* @param change value to be set
* @return Builder
*/
public RemoveAddressChangeBuilder change(final String change) {
this.change = change;
return this;
}
/**
* Value before the change.
* @param builder function to build the previousValue value
* @return Builder
*/
public RemoveAddressChangeBuilder previousValue(
Function builder) {
this.previousValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.of()).build();
return this;
}
/**
* Value before the change.
* @param builder function to build the previousValue value
* @return Builder
*/
public RemoveAddressChangeBuilder withPreviousValue(
Function builder) {
this.previousValue = builder.apply(com.commercetools.history.models.common.AddressBuilder.of());
return this;
}
/**
* Value before the change.
* @param previousValue value to be set
* @return Builder
*/
public RemoveAddressChangeBuilder previousValue(
final com.commercetools.history.models.common.Address previousValue) {
this.previousValue = previousValue;
return this;
}
/**
* value of change}
* @return change
*/
public String getChange() {
return this.change;
}
/**
* Value before the change.
* @return previousValue
*/
public com.commercetools.history.models.common.Address getPreviousValue() {
return this.previousValue;
}
/**
* builds RemoveAddressChange with checking for non-null required values
* @return RemoveAddressChange
*/
public RemoveAddressChange build() {
Objects.requireNonNull(change, RemoveAddressChange.class + ": change is missing");
Objects.requireNonNull(previousValue, RemoveAddressChange.class + ": previousValue is missing");
return new RemoveAddressChangeImpl(change, previousValue);
}
/**
* builds RemoveAddressChange without checking for non-null required values
* @return RemoveAddressChange
*/
public RemoveAddressChange buildUnchecked() {
return new RemoveAddressChangeImpl(change, previousValue);
}
/**
* factory method for an instance of RemoveAddressChangeBuilder
* @return builder
*/
public static RemoveAddressChangeBuilder of() {
return new RemoveAddressChangeBuilder();
}
/**
* create builder for RemoveAddressChange instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static RemoveAddressChangeBuilder of(final RemoveAddressChange template) {
RemoveAddressChangeBuilder builder = new RemoveAddressChangeBuilder();
builder.change = template.getChange();
builder.previousValue = template.getPreviousValue();
return builder;
}
}