Class Product


  • @Entity
    public class Product
    extends Object
    This is the Product entity class, which declares the attributes needed for products which includes, the product ID, username, product description (not required), name, price, stock, postedDate and the Profile id which is annotated by a @ManyToOne. Two attributes which are annotated by a @OneToMany are productImages which gives a list of Image for a Product and order items which gives a list of items of ProductOnOrder.
    • Constructor Detail

      • Product

        public Product()
    • Method Detail

      • getId

        public Long getId()
        Gets the id
        Returns:
        id
      • getName

        @NonNull
        public String getName()
        Gets the name
        Returns:
        name
      • setName

        public void setName​(@NonNull
                            String name)
        Sets name
        Parameters:
        name - - String
      • getDescription

        public String getDescription()
        Gets the product description.
        Returns:
        The product description.
      • setDescription

        public void setDescription​(String description)
        Parameters:
        description - - String
      • getPrice

        public int getPrice()
        Gets the product price.
        Returns:
        The product's price.
      • setPrice

        public void setPrice​(int price)
        Sets price
        Parameters:
        price - - int
      • getStock

        public int getStock()
        Gets the remaining inventory for the product.
        Returns:
        The current quantity remaining in-stock for the product.
      • setStock

        public void setStock​(int stock)
        Sets stock
        Parameters:
        stock - - int
      • getPostedDate

        @NonNull
        public Date getPostedDate()
        Gets the creation timestamp for the product.
        Returns:
        The timestamp for when the product was first posted.
      • getProfile

        @NonNull
        public Profile getProfile()
        Gets the Profile selling the product.
        Returns:
        The seller Profile.
      • setProfile

        public void setProfile​(@NonNull
                               Profile profile)
        Sets Profile
        Parameters:
        profile - - Profile
      • getProductImages

        @NonNull
        public List<Image> getProductImages()
        Gets a list of Image objects for the product.
        Returns:
        List of productImages
      • getOrderItems

        @NonNull
        public List<ProductOnOrder> getOrderItems()
        Gets a list of products on an Order.
        Returns:
        List of orderItems