Class Product

    • Constructor Detail

      • Product

        public Product​(String name,
                       javax.money.MonetaryAmount price)
        Creates a new Product with the given name and price.
        Parameters:
        name - must not be null or empty.
        price - must not be null.
      • Product

        public Product​(String name,
                       javax.money.MonetaryAmount price,
                       Metric metric)
        Creates a new Product with the given name, price and Metric.
        Parameters:
        name - the name of the Product, must not be null or empty.
        price - the price of the Product, must not be null.
        metric - the Metric of the Product, must not be null.
      • Product

        protected Product()
    • Method Detail

      • getCategories

        public org.springframework.data.util.Streamable<String> getCategories()
        Returns the categories the Product is assigned to.
        Returns:
        will never be null.
      • addCategory

        public final boolean addCategory​(String category)
        Adds the Product to the given category.
        Parameters:
        category - must not be null or empty.
        Returns:
      • removeCategory

        public final boolean removeCategory​(String category)
      • supports

        public boolean supports​(Quantity quantity)
        Returns whether the Product supports the given Quantity.
        Parameters:
        quantity -
        Returns:
      • createQuantity

        public Quantity createQuantity​(double amount)
        Creates a Quantity of the given amount and the current Product's underlying Metric.
        Parameters:
        amount - must not be null.
        Returns:
      • createQuantity

        public Quantity createQuantity​(long amount)
        Creates a Quantity of the given amount and the current Product's underlying Metric.
        Parameters:
        amount - must not be null.
        Returns:
      • getName

        @NonNull
        public @NonNull String getName()
      • setName

        public void setName​(@NonNull
                            @NonNull String name)
      • getPrice

        @NonNull
        public @NonNull javax.money.MonetaryAmount getPrice()
      • setPrice

        public void setPrice​(@NonNull
                             @NonNull javax.money.MonetaryAmount price)