| 12345678910111213141516171819202122232425262728 |
- package org.leumasjaffe.recipe.model;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.List;
- import java.util.Optional;
- import java.util.stream.Collectors;
- import javax.swing.ImageIcon;
- import com.fasterxml.jackson.annotation.JsonIgnore;
- import lombok.Data;
- @Data
- public class Recipe {
- String title;
- String description;
- Object nutrition;
- int servings;
- Optional<ImageIcon> photo; // TODO JSONIZATION
- List<Product> products = new ArrayList<>();
-
- @JsonIgnore
- Collection<Ingredient> getIngredients() {
- return products.stream().flatMap(Product::getIngredientsAsStream).collect(Collectors.toList());
- }
- }
|