io.sphere.sdk.carts.commands.CartReplicationDraftBuilder Maven / Gradle / Ivy
package io.sphere.sdk.carts.commands;
import io.sphere.sdk.carts.CartLike;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import java.util.Optional;
import javax.annotation.Generated;
/**
* Builder for {@link CartReplicationDraft}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.DraftBuilderGenerator",
comments = "Generated from: io.sphere.sdk.carts.commands.CartReplicationDraft"
)
public final class CartReplicationDraftBuilder extends Base implements Builder {
private Reference extends CartLike> reference;
CartReplicationDraftBuilder() {
}
CartReplicationDraftBuilder(final Reference extends CartLike> reference) {
this.reference = reference;
}
/**
* Sets the {@code reference} property of this builder.
*
* @param reference the value for {@link CartReplicationDraft#getReference()}
* @return this builder
*/
public CartReplicationDraftBuilder reference(final Referenceable extends CartLike> reference) {
this.reference = Optional.ofNullable(reference).map(Referenceable::toReference).orElse(null);;
return this;
}
public Reference extends CartLike> getReference() {
return reference;
}
/**
* Creates a new instance of {@code CartReplicationDraftDsl} with the values of this builder.
*
* @return the instance
*/
public CartReplicationDraftDsl build() {
return new CartReplicationDraftDsl(reference);
}
/**
* Creates a new object initialized with the given values.
*
* @param reference initial value for the {@link CartReplicationDraft#getReference()} property
* @return new object initialized with the given values
*/
public static CartReplicationDraftBuilder of(final Reference extends CartLike> reference) {
return new CartReplicationDraftBuilder(reference);
}
/**
* Creates a new object initialized with the fields of the template parameter.
*
* @param template the template
* @return a new object initialized from the template
*/
public static CartReplicationDraftBuilder of(final CartReplicationDraft template) {
return new CartReplicationDraftBuilder(template.getReference());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy