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