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

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

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

import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedStrings;

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

public class ProductDataBuilder extends ProductDataProductDraftBuilderBase implements Builder {

    private final ProductVariant masterVariant;
    private List variants = Collections.emptyList();

    private ProductDataBuilder(LocalizedStrings name, LocalizedStrings slug, ProductVariant masterVariant) {
        super(name, slug);
        this.masterVariant = masterVariant;
    }

    public static ProductDataBuilder of(LocalizedStrings name, LocalizedStrings slug, ProductVariant masterVariant) {
        return new ProductDataBuilder(name, slug, masterVariant);
    }

    @Override
    protected ProductDataBuilder getThis() {
        return this;
    }

    @Override
    public ProductData build() {
        return new ProductDataImpl(getName(), getCategories(), getDescription(), getSlug(), getMetaTitle(), getMetaDescription(), getMetaKeywords(), masterVariant, variants);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy