public class Variant
extends java.lang.Object
product
in a product catalog.Modifier and Type | Method and Description |
---|---|
static Variant |
create(int id,
java.lang.String sku,
java.util.List<Price> prices,
java.util.List<Image> images,
java.util.List<Attribute> attributes,
VariantAvailability availability) |
java.lang.Object |
get(java.lang.String attributeName)
Returns the value of custom attribute.
|
Attribute |
getAttribute(java.lang.String attributeName)
Finds custom attribute with given name.
|
java.util.List<Attribute> |
getAttributes()
Custom attributes of this variant.
|
VariantAvailability |
getAvailability()
The inventory status of this variant.
|
org.joda.time.DateTime |
getDateTime(java.lang.String attributeName)
Returns the value of a custom DateTime attribute.
|
double |
getDouble(java.lang.String attributeName)
Returns the value of a custom number attribute.
|
Attribute.Enum |
getEnum(java.lang.String attributeName)
Returns the value of a custom Enum attribute.
|
Image |
getFeaturedImage()
The main image for this variant - the first image in the
images list. |
int |
getId()
Unique id of this variant.
|
java.util.List<Image> |
getImages()
Images attached to this variant.
|
int |
getInt(java.lang.String attributeName)
Returns the value of a custom number attribute.
|
Money |
getMoney(java.lang.String attributeName)
Returns the value of a custom money attribute.
|
Price |
getPrice()
The first price of this variant.
|
Price |
getPrice(java.lang.String currencyCode)
Selects a price for the given currency, defined for all countries and all customer groups.
|
Price |
getPrice(java.lang.String currencyCode,
com.neovisionaries.i18n.CountryCode country)
Selects a price for the given currency and country, defined for all customer groups.
|
Price |
getPrice(java.lang.String currencyCode,
com.neovisionaries.i18n.CountryCode country,
Reference<CustomerGroup> customerGroup)
Selects price for the given currency, country and customer group.
|
Price |
getPrice(java.lang.String currencyCode,
Reference<CustomerGroup> customerGroup)
Selects a price for the given currency and customer group, defined for all countries.
|
java.util.List<Price> |
getPrices()
Price of this variant.
|
java.lang.String |
getSKU()
SKU (Stock Keeping Unit) of this variant.
|
java.lang.String |
getString(java.lang.String attributeName)
Returns the value of a custom string attribute.
|
boolean |
hasAttribute(java.lang.String attributeName)
Returns true if a custom attribute with given name is present.
|
java.lang.String |
toString() |
public static Variant create(int id, java.lang.String sku, java.util.List<Price> prices, java.util.List<Image> images, java.util.List<Attribute> attributes, VariantAvailability availability)
public Image getFeaturedImage()
images
list.public boolean hasAttribute(java.lang.String attributeName)
public Attribute getAttribute(java.lang.String attributeName)
public java.lang.Object get(java.lang.String attributeName)
public java.lang.String getString(java.lang.String attributeName)
public int getInt(java.lang.String attributeName)
public double getDouble(java.lang.String attributeName)
public Money getMoney(java.lang.String attributeName)
public org.joda.time.DateTime getDateTime(java.lang.String attributeName)
public Attribute.Enum getEnum(java.lang.String attributeName)
public int getId()
public java.lang.String getSKU()
@Nonnull public java.util.List<Image> getImages()
@Nonnull public java.util.List<Attribute> getAttributes()
public VariantAvailability getAvailability()
@Nullable public Price getPrice()
@Nonnull public java.util.List<Price> getPrices()
@Nullable public Price getPrice(java.lang.String currencyCode, com.neovisionaries.i18n.CountryCode country, Reference<CustomerGroup> customerGroup)
currencyCode
- ISO Currency Code.country
- ISO Country Code. null
if you want a generic price that applies in all countries.customerGroup
- Customer group. EmptyReference
or null
if you want a generic price that applies to all customer groups.null
if no matching price exists.@Nullable public Price getPrice(java.lang.String currencyCode, com.neovisionaries.i18n.CountryCode country)
@Nullable public Price getPrice(java.lang.String currencyCode, Reference<CustomerGroup> customerGroup)
@Nullable public Price getPrice(java.lang.String currencyCode)
public java.lang.String toString()
toString
in class java.lang.Object