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

io.sphere.sdk.channels.ChannelDraftDslBase Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.models.Address;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.GeoJSON;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.types.CustomFieldsDraft;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Set;
import javax.annotation.Generated;
import javax.annotation.Nullable;

/**
 * Abstract base dsl class for {@link ChannelDraft} which needs to be extended to add additional methods.
 * Subclasses have to provide the same non-default constructor as this class.
 */
@Generated(
    value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
    comments = "Generated from: io.sphere.sdk.channels.ChannelDraft"
)
abstract class ChannelDraftDslBase extends Base implements ChannelDraft {
  @Nullable
  private Address address;

  @Nullable
  private CustomFieldsDraft custom;

  @Nullable
  private LocalizedString description;

  @Nullable
  private GeoJSON geoLocation;

  private String key;

  @Nullable
  private LocalizedString name;

  @Nullable
  private Set roles;

  @JsonCreator
  ChannelDraftDslBase(@Nullable final Address address, @Nullable final CustomFieldsDraft custom,
      @Nullable final LocalizedString description, @Nullable final GeoJSON geoLocation,
      final String key, @Nullable final LocalizedString name,
      @Nullable final Set roles) {
    this.address = address;
    this.custom = custom;
    this.description = description;
    this.geoLocation = geoLocation;
    this.key = key;
    this.name = name;
    this.roles = roles;
  }

  @Nullable
  public Address getAddress() {
    return address;
  }

  @Nullable
  public CustomFieldsDraft getCustom() {
    return custom;
  }

  @Nullable
  public LocalizedString getDescription() {
    return description;
  }

  @Nullable
  public GeoJSON getGeoLocation() {
    return geoLocation;
  }

  public String getKey() {
    return key;
  }

  @Nullable
  public LocalizedString getName() {
    return name;
  }

  @Nullable
  public Set getRoles() {
    return roles;
  }

  /**
   * Creates a new builder with the values of this object.
   *
   * @return new builder
   */
  public ChannelDraftBuilder newBuilder() {
    return new ChannelDraftBuilder(address, custom, description, geoLocation, key, name, roles);
  }

  @SuppressWarnings("unchecked")
  public T withAddress(@Nullable final Address address) {
    return (T) newBuilder().address(address).build();
  }

  @SuppressWarnings("unchecked")
  public T withCustom(@Nullable final CustomFieldsDraft custom) {
    return (T) newBuilder().custom(custom).build();
  }

  @SuppressWarnings("unchecked")
  public T withDescription(@Nullable final LocalizedString description) {
    return (T) newBuilder().description(description).build();
  }

  @SuppressWarnings("unchecked")
  public T withGeoLocation(@Nullable final GeoJSON geoLocation) {
    return (T) newBuilder().geoLocation(geoLocation).build();
  }

  @SuppressWarnings("unchecked")
  public T withKey(final String key) {
    return (T) newBuilder().key(key).build();
  }

  @SuppressWarnings("unchecked")
  public T withName(@Nullable final LocalizedString name) {
    return (T) newBuilder().name(name).build();
  }

  @SuppressWarnings("unchecked")
  public T withRoles(@Nullable final Set roles) {
    return (T) newBuilder().roles(roles).build();
  }

  /**
   * Creates a new object initialized with the given values.
   *
   * @param key initial value for the {@link ChannelDraft#getKey()} property
   * @return new object initialized with the given values
   */
  public static ChannelDraftDsl of(final String key) {
    return new ChannelDraftDsl(null, null, null, null, key, null, null);
  }

  /**
   * 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 ChannelDraftDsl of(final ChannelDraft template) {
    return new ChannelDraftDsl(template.getAddress(), template.getCustom(), template.getDescription(), template.getGeoLocation(), template.getKey(), template.getName(), template.getRoles());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy