public class

Item

extends Object
implements Parcelable JSONSerializable Cloneable
java.lang.Object
   ↳ com.ad4screen.sdk.analytics.Item

Class Overview

Item Object to use for analytics event

Summary

Constants
String KEY_CATEGORY
String KEY_CURRENCY
String KEY_ID
String KEY_LABEL
String KEY_PRICE
String KEY_QUANTITY
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Item> CREATOR
Public Constructors
Item(String id, String label, String category, String currency, double price, int quantity)
Constructor of the Item
Public Methods
int describeContents()
String getCategory()
Retrieve Item category
String getCurrency()
Retrieve Item currency
String getId()
Retrieve Item id
String getLabel()
Retrieve Item label
double getPrice()
Retrieve Item price
int getQuantity()
Retrieve Item quantity
void setCategory(String mCategory)
Set Item category
void setCurrency(String currency)
Set Item currency code (example : EUR)
void setId(String id)
Set Item id
void setLabel(String mLabel)
Set Item label
void setPrice(double price)
Set Item price
void setQuantity(int quantity)
Set Item quantity
JSONObject toJSON()
Serialize an object into a JSONObject
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable
From interface com.ad4screen.sdk.common.persistence.JSONSerializable

Constants

public static final String KEY_CATEGORY

Constant Value: "category"

public static final String KEY_CURRENCY

Constant Value: "currency"

public static final String KEY_ID

Constant Value: "articleId"

public static final String KEY_LABEL

Constant Value: "label"

public static final String KEY_PRICE

Constant Value: "price"

public static final String KEY_QUANTITY

Constant Value: "quantity"

Fields

public static final Creator<Item> CREATOR

Public Constructors

public Item (String id, String label, String category, String currency, double price, int quantity)

Constructor of the Item

Parameters
id unique id of this item
label label of the item
category category of the item
currency currency of this item
price price of this item in the currency specified
quantity quantity of this item
Throws
IllegalArgumentException if currency is invalid

Public Methods

public int describeContents ()

public String getCategory ()

Retrieve Item category

Returns
  • item category

public String getCurrency ()

Retrieve Item currency

Returns
  • item currency in ISO4217 format

public String getId ()

Retrieve Item id

Returns
  • item id

public String getLabel ()

Retrieve Item label

Returns
  • item label

public double getPrice ()

Retrieve Item price

Returns
  • item price

public int getQuantity ()

Retrieve Item quantity

Returns
  • item quantity

public void setCategory (String mCategory)

Set Item category

public void setCurrency (String currency)

Set Item currency code (example : EUR)

Parameters
currency the currency to set in ISO4217 format
Throws
IllegalArgumentException if currency is invalid

public void setId (String id)

Set Item id

public void setLabel (String mLabel)

Set Item label

public void setPrice (double price)

Set Item price

public void setQuantity (int quantity)

Set Item quantity

Parameters
quantity (must be >= 0 or IllegalArgumentException will be thrown)

public JSONObject toJSON ()

Serialize an object into a JSONObject

Returns
  • JSONObject of the serialized class
Throws
JSONException

public void writeToParcel (Parcel dest, int flags)