Class ShoppingItemMapper
java.lang.Object
edu.ntnu.idatt2106_2023_06.backend.mapper.ShoppingItemMapper
The ShoppingItemMapper class contains methods for mapping between FridgeItems and ShoppingItems model, and
between Item and ShoppingListLoadDTO DTO.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ShoppingItemstoShoppingItem(FridgeItems fridgeItems) This method converts a FridgeItems object to a ShoppingItems object.static ShoppingListLoadDTOtoShoppingListLoadDTO(Item item, int quantity, boolean suggestion) This method converts an Item object to a ShoppingListLoadDTO object.
-
Constructor Details
-
ShoppingItemMapper
public ShoppingItemMapper()
-
-
Method Details
-
toShoppingItem
This method converts a FridgeItems object to a ShoppingItems object.- Parameters:
fridgeItems- FridgeItems object to be converted.- Returns:
- ShoppingItems object.
-
toShoppingListLoadDTO
public static ShoppingListLoadDTO toShoppingListLoadDTO(Item item, int quantity, boolean suggestion) This method converts an Item object to a ShoppingListLoadDTO object.- Parameters:
item- Item object to be converted.quantity- The quantity of the item.suggestion- Boolean value representing whether the item is a suggestion or not.- Returns:
- ShoppingListLoadDTO object.
-