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

io.sphere.sdk.projects.CartClassificationDraftBuilder Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.projects;

import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedEnumValue;
import io.sphere.sdk.utils.SphereInternalUtils;
import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Generated;

/**
 * Builder for {@link CartClassificationDraft}.
 */
@Generated(
    value = "io.sphere.sdk.annotations.processors.generators.DraftBuilderGenerator",
    comments = "Generated from: io.sphere.sdk.projects.CartClassificationDraft"
)
public final class CartClassificationDraftBuilder extends Base implements Builder {
  private Set values;

  CartClassificationDraftBuilder() {
  }

  CartClassificationDraftBuilder(final Set values) {
    this.values = values;
  }

  /**
   * Sets the {@code values} property of this builder.
   *
   * @param values the value for {@link CartClassificationDraft#getValues()}
   * @return this builder
   */
  public CartClassificationDraftBuilder values(final Set values) {
    this.values = values;
    return this;
  }

  public Set getValues() {
    return values;
  }

  /**
   * Concatenate {@code values} parameter to the {@code values} set property of this builder.
   *
   * @param values the value for {@link CartClassificationDraft#getValues()}
   * @return this builder
   */
  public CartClassificationDraftBuilder plusValues(final Set values) {
    this.values =  SphereInternalUtils.setOf(Optional.ofNullable(this.values).orElseGet(HashSet::new), values);
    return this;
  }

  /**
   * Adds {@code values} parameter to the {@code values} set property of this builder.
   *
   * @param values the value of the element to add to {@link CartClassificationDraft#getValues()}
   * @return this builder
   */
  public CartClassificationDraftBuilder plusValues(final LocalizedEnumValue values) {
    this.values =  SphereInternalUtils.setOf(Collections.singleton(values), Optional.ofNullable(this.values).orElseGet(HashSet::new));
    return this;
  }

  /**
   * Creates a new instance of {@code CartClassificationDraftDsl} with the values of this builder.
   *
   * @return the instance
   */
  public CartClassificationDraftDsl build() {
    return new CartClassificationDraftDsl(values);
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param values initial value for the {@link CartClassificationDraft#getValues()} property
   * @return new object initialized with the given values
   */
  public static CartClassificationDraftBuilder of(final Set values) {
    return new CartClassificationDraftBuilder(values);
  }

  /**
   * 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 CartClassificationDraftBuilder of(final CartClassificationDraft template) {
    return new CartClassificationDraftBuilder(template.getValues());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy