Class ItemInfo


  • public class ItemInfo
    extends java.lang.Object
    Item info stores details about items. Note: two item infos are considered equal if there name is equal. This allows fetching old item infos and updating them by item name.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name
      The name .
      protected double price
      The price.
      protected int quantity
      The quantity.
    • Constructor Summary

      Constructors 
      Constructor Description
      ItemInfo()
      Create a new item info.
      ItemInfo​(java.lang.String name)
      Create a new item info.
      ItemInfo​(java.lang.String name, double price, int quantity)
      Create a new item info.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Test if an object is equal to this one.
      java.lang.String getName()
      Get the name.
      double getPrice()
      Get the price.
      int getQuantity()
      Get the quantity.
      int hashCode()
      Get the hashcode.
      void setName​(java.lang.String name)
      Set the name.
      void setPrice​(double price)
      Set the price.
      void setQuantity​(int quantity)
      Set the quantity.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • name

        protected java.lang.String name
        The name .
      • price

        protected double price
        The price.
      • quantity

        protected int quantity
        The quantity.
    • Constructor Detail

      • ItemInfo

        public ItemInfo()
        Create a new item info.
      • ItemInfo

        public ItemInfo​(java.lang.String name)
        Create a new item info.
      • ItemInfo

        public ItemInfo​(java.lang.String name,
                        double price,
                        int quantity)
        Create a new item info.
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name.
        Returns:
        the name.
      • setName

        public void setName​(java.lang.String name)
        Set the name.
        Parameters:
        name - The name to set.
      • getPrice

        public double getPrice()
        Get the price.
        Returns:
        the price.
      • setPrice

        public void setPrice​(double price)
        Set the price.
        Parameters:
        price - The price to set.
      • getQuantity

        public int getQuantity()
        Get the quantity.
        Returns:
        The quantity.
      • setQuantity

        public void setQuantity​(int quantity)
        Set the quantity.
        Parameters:
        quantity - The quantity to set.
      • hashCode

        public int hashCode()
        Get the hashcode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hashcode.
      • equals

        public boolean equals​(java.lang.Object obj)
        Test if an object is equal to this one.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to test.
        Returns:
        True, if both are equal.