Class Product


  • public final class Product
    extends java.lang.Object
    A Product represents any good or service that a user may purchase, view, or otherwise interact with in your app. The Product class is built to be immutable - use the Product.Builder class to create a Product. Product objects are designed to be used with CommerceEvent.
    • Method Detail

      • getCustomAttributes

        @Nullable
        public java.util.Map<java.lang.String,​java.lang.String> getCustomAttributes()
        Returns:
        Retrieve the Map of custom attributes set on this Product
        See Also:
        Product.Builder.customAttributes(Map)
      • getTotalAmount

        public double getTotalAmount()
      • setEqualityComparator

        public static void setEqualityComparator​(@Nullable
                                                 Product.EqualityComparator comparator)
        Optionally customize the EqualityComparator. If the comparator is null, the default comparator will be restored. The default comparator compares Products by their toString() value.
        Parameters:
        comparator -
      • getName

        @NonNull
        public java.lang.String getName()
        Returns:
        the name description of the Product
      • getCategory

        @Nullable
        public java.lang.String getCategory()
        Returns:
        the category description of the Product
      • getCouponCode

        @Nullable
        public java.lang.String getCouponCode()
        Returns:
        the coupon code associated with the Product
      • getSku

        @NonNull
        public java.lang.String getSku()
        Returns:
        the SKU/ID associated with the Product
      • getPosition

        @Nullable
        public java.lang.Integer getPosition()
        Returns:
        the position of the product on the page/product impression list
      • getUnitPrice

        public double getUnitPrice()
        Returns:
        the unit price of a single Product
      • getQuantity

        public double getQuantity()
        Returns:
        the quantity of Products
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • getBrand

        @Nullable
        public java.lang.String getBrand()
        Returns:
        the brand of the Product
      • getVariant

        @Nullable
        public java.lang.String getVariant()
        Returns:
        the variant or version of the Product
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromString

        @Nullable
        public static Product fromString​(@NonNull
                                         java.lang.String json)