io.sphere.sdk.carts.commands.CartReplicationDraftDsl Maven / Gradle / Ivy
package io.sphere.sdk.carts.commands;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.carts.CartLike;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import java.util.Optional;
import javax.annotation.Generated;
/**
* Dsl class for {@link CartReplicationDraft}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.carts.commands.CartReplicationDraft"
)
public final class CartReplicationDraftDsl extends Base implements CartReplicationDraft {
private Reference extends CartLike> reference;
@JsonCreator
CartReplicationDraftDsl(final Reference extends CartLike> reference) {
this.reference = reference;
}
public Reference extends CartLike> getReference() {
return reference;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public CartReplicationDraftBuilder newBuilder() {
return new CartReplicationDraftBuilder(reference);
}
public CartReplicationDraftDsl withReference(final Referenceable extends CartLike> reference) {
return newBuilder().reference(Optional.ofNullable(reference).map(Referenceable::toReference).orElse(null)).build();
}
/**
* 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 CartReplicationDraftDsl of(final Reference extends CartLike> reference) {
return new CartReplicationDraftDsl(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 CartReplicationDraftDsl of(final CartReplicationDraft template) {
return new CartReplicationDraftDsl(template.getReference());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy