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.lang.String;
import java.util.Optional;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* 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 {
@Nullable
private String key;
private Reference extends CartLike> reference;
@JsonCreator
CartReplicationDraftDsl(@Nullable final String key,
final Reference extends CartLike> reference) {
this.key = key;
this.reference = reference;
}
@Nullable
public String getKey() {
return key;
}
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(key, reference);
}
public CartReplicationDraftDsl withKey(@Nullable final String key) {
return newBuilder().key(key).build();
}
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(null, 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.getKey(), template.getReference());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy