Class Product

java.lang.Object
com.esprit.models.products.Product

@Entity public class Product extends Object
The `Product` class represents a product.
  • Field Details

  • Constructor Details

    • Product

      public Product(String name, int price, String image, String description, List<ProductCategory> categories, int quantity)
      Constructor without id for creating new product instances.
      Parameters:
      name - the name of the product
      price - the price of the product
      image - the image URL of the product
      description - the description of the product
      categories - the categories of the product
      quantity - the quantity of the product
    • Product

      public Product(Long productId)
      Constructor with only id for creating product references.
      Parameters:
      productId - the ID of the product
  • Method Details

    • getCategories

      public List<ProductCategory> getCategories()
      Returns the categories of the product.
      Returns:
      the categories of the product
    • setCategories

      public void setCategories(List<ProductCategory> categories)
      Sets the categories of the product.
      Parameters:
      categories - the categories of the product
    • getCategoryNames

      public String getCategoryNames()
      Returns the name of the categories of the product, concatenated as a string.
      Returns:
      the name of the categories of the product