io.sphere.sdk.shippingmethods.ShippingMethodDraftBuilderBase Maven / Gradle / Ivy
package io.sphere.sdk.shippingmethods;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.ResourceIdentifier;
import io.sphere.sdk.taxcategories.TaxCategory;
import io.sphere.sdk.types.CustomFieldsDraft;
import io.sphere.sdk.utils.SphereInternalUtils;
import java.lang.Boolean;
import java.lang.Deprecated;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Abstract base builder for {@link ShippingMethodDraft} 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.DraftBuilderGenerator",
comments = "Generated from: io.sphere.sdk.shippingmethods.ShippingMethodDraft"
)
abstract class ShippingMethodDraftBuilderBase extends Base implements Builder {
Boolean _default;
@Nullable
CustomFieldsDraft custom;
@Nullable
String description;
@Nullable
String key;
@Nullable
LocalizedString localizedDescription;
@Nullable
LocalizedString localizedName;
String name;
@Nullable
String predicate;
ResourceIdentifier taxCategory;
List zoneRates;
protected ShippingMethodDraftBuilderBase() {
}
protected ShippingMethodDraftBuilderBase(final Boolean _default,
@Nullable final CustomFieldsDraft custom, @Nullable final String description,
@Nullable final String key, @Nullable final LocalizedString localizedDescription,
@Nullable final LocalizedString localizedName, final String name,
@Nullable final String predicate, final ResourceIdentifier taxCategory,
final List zoneRates) {
this._default = _default;
this.custom = custom;
this.description = description;
this.key = key;
this.localizedDescription = localizedDescription;
this.localizedName = localizedName;
this.name = name;
this.predicate = predicate;
this.taxCategory = taxCategory;
this.zoneRates = zoneRates;
}
/**
* Sets the {@code default} property of this builder.
*
* @param _default the value for {@link ShippingMethodDraft#isDefault()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T _default(final Boolean _default) {
this._default = _default;
return (T) this;
}
/**
* Sets the {@code default} property of this builder.
*
* @param _default the value for {@link ShippingMethodDraft#isDefault()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T isDefault(final Boolean _default) {
this._default = _default;
return (T) this;
}
/**
* Sets the {@code custom} property of this builder.
*
* @param custom the value for {@link ShippingMethodDraft#getCustom()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T custom(@Nullable final CustomFieldsDraft custom) {
this.custom = custom;
return (T) this;
}
/**
* Sets the {@code description} property of this builder.
*
* @param description the value for {@link ShippingMethodDraft#getDescription()}
* @return this builder
*
* @deprecated This method will be removed with the next major SDK update.
*/
@Deprecated
@SuppressWarnings("unchecked")
public T description(@Nullable final String description) {
this.description = description;
return (T) this;
}
/**
* Sets the {@code key} property of this builder.
*
* @param key the value for {@link ShippingMethodDraft#getKey()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T key(@Nullable final String key) {
this.key = key;
return (T) this;
}
/**
* Sets the {@code localizedDescription} property of this builder.
*
* @param localizedDescription the value for {@link ShippingMethodDraft#getLocalizedDescription()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T localizedDescription(@Nullable final LocalizedString localizedDescription) {
this.localizedDescription = localizedDescription;
return (T) this;
}
/**
* Sets the {@code localizedName} property of this builder.
*
* @param localizedName the value for {@link ShippingMethodDraft#getLocalizedName()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T localizedName(@Nullable final LocalizedString localizedName) {
this.localizedName = localizedName;
return (T) this;
}
/**
* Sets the {@code name} property of this builder.
*
* @param name the value for {@link ShippingMethodDraft#getName()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T name(final String name) {
this.name = name;
return (T) this;
}
/**
* Sets the {@code predicate} property of this builder.
*
* @param predicate the value for {@link ShippingMethodDraft#getPredicate()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T predicate(@Nullable final String predicate) {
this.predicate = predicate;
return (T) this;
}
/**
* Sets the {@code taxCategory} property of this builder.
*
* @param taxCategory the value for {@link ShippingMethodDraft#getTaxCategory()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T taxCategory(final ResourceIdentifier taxCategory) {
this.taxCategory = taxCategory;
return (T) this;
}
/**
* Sets the {@code zoneRates} property of this builder.
*
* @param zoneRates the value for {@link ShippingMethodDraft#getZoneRates()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T zoneRates(final List zoneRates) {
this.zoneRates = zoneRates;
return (T) this;
}
@JsonProperty("isDefault")
public Boolean isDefault() {
return _default;
}
@Nullable
public CustomFieldsDraft getCustom() {
return custom;
}
/**
*
* @deprecated This method will be removed with the next major SDK update.
*/
@Nullable
@Deprecated
public String getDescription() {
return description;
}
@Nullable
public String getKey() {
return key;
}
@Nullable
public LocalizedString getLocalizedDescription() {
return localizedDescription;
}
@Nullable
public LocalizedString getLocalizedName() {
return localizedName;
}
public String getName() {
return name;
}
@Nullable
public String getPredicate() {
return predicate;
}
public ResourceIdentifier getTaxCategory() {
return taxCategory;
}
public List getZoneRates() {
return zoneRates;
}
/**
* Concatenate {@code zoneRates} parameter to the {@code zoneRates} list property of this builder.
*
* @param zoneRates the value for {@link ShippingMethodDraft#getZoneRates()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T plusZoneRates(final List zoneRates) {
this.zoneRates = SphereInternalUtils.listOf(Optional.ofNullable(this.zoneRates).orElseGet(ArrayList::new), zoneRates);
return (T) this;
}
/**
* Adds {@code zoneRates} parameter to the {@code zoneRates} list property of this builder.
*
* @param zoneRates the value of the element to add to {@link ShippingMethodDraft#getZoneRates()}
* @return this builder
*/
@SuppressWarnings("unchecked")
public T plusZoneRates(final ZoneRateDraft zoneRates) {
this.zoneRates = SphereInternalUtils.listOf(Optional.ofNullable(this.zoneRates).orElseGet(ArrayList::new), Collections.singletonList(zoneRates));
return (T) this;
}
/**
* Creates a new instance of {@code ShippingMethodDraftDsl} with the values of this builder.
*
* @return the instance
*/
public ShippingMethodDraftDsl build() {
return new ShippingMethodDraftDsl(_default, custom, description, key, localizedDescription, localizedName, name, predicate, taxCategory, zoneRates);
}
/**
* Creates a new object initialized with the given values.
*
* @param name initial value for the {@link ShippingMethodDraft#getName()} property
* @param description initial value for the {@link ShippingMethodDraft#getDescription()} property
* @param taxCategory initial value for the {@link ShippingMethodDraft#getTaxCategory()} property
* @param zoneRates initial value for the {@link ShippingMethodDraft#getZoneRates()} property
* @param _default initial value for the {@link ShippingMethodDraft#isDefault()} property
* @return new object initialized with the given values
*/
public static ShippingMethodDraftBuilder of(final String name, @Nullable final String description,
final ResourceIdentifier taxCategory, final List zoneRates,
final Boolean _default) {
return new ShippingMethodDraftBuilder(_default, null, description, null, null, null, name, null, taxCategory, zoneRates);
}
/**
* Creates a new object initialized with the given values.
*
* @param name initial value for the {@link ShippingMethodDraft#getName()} property
* @param taxCategory initial value for the {@link ShippingMethodDraft#getTaxCategory()} property
* @param zoneRates initial value for the {@link ShippingMethodDraft#getZoneRates()} property
* @param _default initial value for the {@link ShippingMethodDraft#isDefault()} property
* @return new object initialized with the given values
*/
public static ShippingMethodDraftBuilder of(final String name,
final ResourceIdentifier taxCategory, final List zoneRates,
final Boolean _default) {
return new ShippingMethodDraftBuilder(_default, null, null, null, null, null, name, null, taxCategory, zoneRates);
}
/**
* Creates a new object initialized with the given values.
*
* @param name initial value for the {@link ShippingMethodDraft#getName()} property
* @param localizedDescription initial value for the {@link ShippingMethodDraft#getLocalizedDescription()} property
* @param taxCategory initial value for the {@link ShippingMethodDraft#getTaxCategory()} property
* @param zoneRates initial value for the {@link ShippingMethodDraft#getZoneRates()} property
* @param _default initial value for the {@link ShippingMethodDraft#isDefault()} property
* @return new object initialized with the given values
*/
public static ShippingMethodDraftBuilder of(final String name,
@Nullable final LocalizedString localizedDescription,
final ResourceIdentifier taxCategory, final List zoneRates,
final Boolean _default) {
return new ShippingMethodDraftBuilder(_default, null, null, null, localizedDescription, null, name, null, taxCategory, zoneRates);
}
/**
* 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 ShippingMethodDraftBuilder of(final ShippingMethodDraft template) {
return new ShippingMethodDraftBuilder(template.isDefault(), template.getCustom(), template.getDescription(), template.getKey(), template.getLocalizedDescription(), template.getLocalizedName(), template.getName(), template.getPredicate(), template.getTaxCategory(), template.getZoneRates());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy