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

io.sphere.sdk.products.ProductDataNewProductBuilderBase Maven / Gradle / Ivy

There is a newer version: 1.0.0-M3
Show newest version
package io.sphere.sdk.products;

import io.sphere.sdk.categories.Category;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

abstract class ProductDataNewProductBuilderBase> extends Base {
    private LocalizedString name;
    private LocalizedString slug;
    private Optional description = Optional.empty();
    private Optional metaTitle = Optional.empty();
    private Optional metaDescription = Optional.empty();
    private Optional metaKeywords = Optional.empty();
    private List> categories = Collections.emptyList();
    private List variants = Collections.emptyList();

    protected ProductDataNewProductBuilderBase(final LocalizedString name, final LocalizedString slug) {
        this.name = name;
        this.slug = slug;
    }

    public T description(final Optional description) {
        this.description = description;
        return getThis();
    }

    public T description(final LocalizedString description) {
        return description(Optional.of(description));
    }

    public T metaTitle(final Optional metaTitle) {
        this.metaTitle = metaTitle;
        return getThis();
    }

    public T metaTitle(final LocalizedString metaTitle) {
        return metaTitle(Optional.of(metaTitle));
    }

    public T metaDescription(final Optional metaDescription) {
        this.metaDescription = metaDescription;
        return getThis();
    }

    public T metaDescription(final LocalizedString metaDescription) {
        return metaDescription(Optional.of(metaDescription));
    }

    public T metaKeywords(final Optional metaKeywords) {
        this.metaKeywords = metaKeywords;
        return getThis();
    }

    public T metaKeywords(final LocalizedString metaKeywords) {
        return metaKeywords(Optional.of(metaKeywords));
    }

    public T categories(final List> categories) {
        this.categories = categories;
        return getThis();
    }

    public T variants(final List variants) {
        this.variants = variants;
        return getThis();
    }

    public LocalizedString getName() {
        return name;
    }

    public LocalizedString getSlug() {
        return slug;
    }

    public Optional getDescription() {
        return description;
    }

    public Optional getMetaTitle() {
        return metaTitle;
    }

    public Optional getMetaDescription() {
        return metaDescription;
    }

    public Optional getMetaKeywords() {
        return metaKeywords;
    }

    public List> getCategories() {
        return categories;
    }

    public List getVariants() {
        return variants;
    }

    protected abstract T getThis();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy