All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.carts.commands.CartReplicationDraftBuilder Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
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 reference;

  CartReplicationDraftBuilder() {
  }

  CartReplicationDraftBuilder(final Reference 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 reference) {
    this.reference = Optional.ofNullable(reference).map(Referenceable::toReference).orElse(null);;
    return this;
  }

  public Reference 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 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