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

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

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

import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Referenceable;

/**
 * Identifies a {@link io.sphere.sdk.products.ProductVariant}.
 */
public class VariantIdentifier extends Base {
    private final String productId;
    private final Integer variantId;

    private VariantIdentifier(final String productId, final Integer variantId) {
        this.productId = productId;
        this.variantId = variantId;
    }

    public String getProductId() {
        return productId;
    }

    public Integer getVariantId() {
        return variantId;
    }

    public static VariantIdentifier of(final Referenceable product, final Integer variantId) {
        return of(product.toReference().getId(), variantId);
    }

    public static VariantIdentifier of(final String productId, final Integer variantId) {
        return new VariantIdentifier(productId, variantId);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy