Package com.esprit.models.products
Class Product
java.lang.Object
com.esprit.models.products.Product
The `Product` class represents a product.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<ProductCategory>
private String
private Long
private String
private String
private int
private int
private List<ShoppingCart>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the categories of the product.Returns the name of the categories of the product, concatenated as a string.void
setCategories
(List<ProductCategory> categories) Sets the categories of the product.
-
Field Details
-
id
-
name
-
price
private int price -
image
-
description
-
categories
-
quantity
private int quantity -
comments
-
reviews
-
shoppingCarts
-
orderItems
-
-
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 productprice
- the price of the productimage
- the image URL of the productdescription
- the description of the productcategories
- the categories of the productquantity
- the quantity of the product
-
Product
Constructor with only id for creating product references.- Parameters:
productId
- the ID of the product
-
-
Method Details
-
getCategories
Returns the categories of the product.- Returns:
- the categories of the product
-
setCategories
Sets the categories of the product.- Parameters:
categories
- the categories of the product
-
getCategoryNames
Returns the name of the categories of the product, concatenated as a string.- Returns:
- the name of the categories of the product
-