|
|
@@ -0,0 +1,26 @@
|
|
|
+package org.leumasjaffe.recipe.model;
|
|
|
+
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
+
|
|
|
+import lombok.Data;
|
|
|
+
|
|
|
+@Data
|
|
|
+public class Product {
|
|
|
+ String name;
|
|
|
+ List<Card> cards;
|
|
|
+
|
|
|
+ @JsonIgnore
|
|
|
+ Collection<Ingredient> getIngredients() {
|
|
|
+ return getIngredientsAsStream().collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ @JsonIgnore
|
|
|
+ Stream<Ingredient> getIngredientsAsStream() {
|
|
|
+ return cards.stream().flatMap(Card::getIngredientsAsStream);
|
|
|
+ }
|
|
|
+}
|