public class Recipe
extends androidx.databinding.BaseObservable
url
if it was
loaded from a website. title
, favorite
and the lists of Step
s and
Ingredient
s can be customized by the user.Constructor and Description |
---|
Recipe() |
Recipe(AssemblyRecipe data)
This constructor creates a Recipe Entity from the data gathered and processed by Jsoup
|
Recipe(RecipePojo recipePojo)
This constructor recreates a Recipe entity from the
RecipePojo data returned by a database query. |
Modifier and Type | Method and Description |
---|---|
static Recipe |
getEmptyRecipe() |
List<Ingredient> |
getIngredients() |
long |
getRecipeId() |
List<Step> |
getSteps() |
@NotNull String |
getTitle()
This getter is marked Bindable for Data Binding to the EditingFragment.
|
String |
getUrl() |
boolean |
isFavorite()
This getter is marked Bindable for Data Binding to the EditingFragment.
|
static Recipe[] |
populateData()
This array populates the database with dummy Recipes.
|
void |
setFavorite(boolean favorite) |
void |
setIngredient(Ingredient ingredient) |
void |
setIngredients(List<Ingredient> ingredients) |
void |
setRecipeId(long recipeId) |
void |
setStep(Step step) |
void |
setSteps(List<Step> steps) |
void |
setTitle(@NotNull String title) |
void |
setUrl(String url) |
String |
toString() |
public Recipe()
public Recipe(RecipePojo recipePojo)
RecipePojo
data returned by a database query.recipePojo
- is returned by RecipeDao.loadRecipeData(long)
.public Recipe(AssemblyRecipe data)
data
- is the completed AssemblyRecipe
that results from scraping and processing HTML.public long getRecipeId()
public void setRecipeId(long recipeId)
recipeId
- is generated when a recipe is inserted into the database.public String getUrl()
public void setUrl(String url)
url
- is set when a recipe is created from a URL.@NotNull public @NotNull String getTitle()
public void setTitle(@NotNull @NotNull String title)
title
- is set by the user in the EditingFragment.public boolean isFavorite()
public void setFavorite(boolean favorite)
favorite
- is set by the user in the CookbookFragment.public void setStep(Step step)
step
- is a single new Steppublic List<Ingredient> getIngredients()
Ingredient
s.public void setIngredients(List<Ingredient> ingredients)
ingredients
- is a new list of Ingredients.public void setIngredient(Ingredient ingredient)
ingredient
- is a single new Ingredient.public static Recipe getEmptyRecipe()
public static Recipe[] populateData()