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

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

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

import io.sphere.sdk.categories.Category;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.producttypes.ProductType;
import io.sphere.sdk.taxcategories.TaxCategory;

import java.time.Instant;
import java.util.List;
import java.util.Optional;

class ProductToProductProjectionWrapper implements ProductProjection {
    private final Product product;
    private final ProductData productData;

    ProductToProductProjectionWrapper(final Product product, final ProductProjectionType productProjectionType) {
        this.product = product;
        this.productData = product.getMasterData().get(productProjectionType);
    }

    @Override
    public boolean hasStagedChanges() {
        return product.getMasterData().hasStagedChanges();
    }

    @Override
    public String getId() {
        return product.getId();
    }

    @Override
    public LocalizedString getName() {
        return productData.getName();
    }

    @Override
    public List> getCategories() {
        return productData.getCategories();
    }

    @Override
    public Optional getDescription() {
        return productData.getDescription();
    }

    @Override
    public LocalizedString getSlug() {
        return productData.getSlug();
    }

    @Override
    public Optional getMetaTitle() {
        return productData.getMetaTitle();
    }

    @Override
    public Optional getMetaDescription() {
        return productData.getMetaDescription();
    }

    @Override
    public Optional getMetaKeywords() {
        return productData.getMetaKeywords();
    }

    @Override
    public ProductVariant getMasterVariant() {
        return productData.getMasterVariant();
    }

    @Override
    public List getVariants() {
        return productData.getVariants();
    }

    @Override
    public Reference getProductType() {
        return product.getProductType();
    }

    @Override
    public Optional> getTaxCategory() {
        return product.getTaxCategory();
    }

    @Override
    public Instant getCreatedAt() {
        return product.getCreatedAt();
    }

    @Override
    public Instant getLastModifiedAt() {
        return product.getLastModifiedAt();
    }

    @Override
    public long getVersion() {
        return product.getVersion();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy