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

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

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

import io.sphere.sdk.categories.Category;
import io.sphere.sdk.models.*;
import io.sphere.sdk.search.SearchKeywords;

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

abstract class ProductDataProductDraftBuilderBase> extends Base implements WithLocalizedSlug, MetaAttributes {
    private final LocalizedStrings name;
    private final LocalizedStrings 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 SearchKeywords searchKeywords = SearchKeywords.of();

    protected ProductDataProductDraftBuilderBase(final LocalizedStrings name, final LocalizedStrings slug) {
        this.name = name;
        this.slug = slug;
    }

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

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

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

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

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

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

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

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

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

    public T searchKeywords(final SearchKeywords searchKeywords) {
        this.searchKeywords = searchKeywords;
        return getThis();
    }

    public LocalizedStrings getName() {
        return name;
    }

    public LocalizedStrings 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 SearchKeywords getSearchKeywords() {
        return searchKeywords;
    }

    protected abstract T getThis();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy