public class IngredientRepository extends Object
Constructor and Description |
---|
IngredientRepository(Context context)
This is the constructor for the IngredientRepository.
|
Modifier and Type | Method and Description |
---|---|
Completable |
delete(Ingredient ingredient)
This is the method to delete a ingredient from the SmartCheff database.
|
LiveData<List<Ingredient>> |
getAll()
This is the method to get all the ingredients in the SmartCheff database.
|
Completable |
save(Ingredient ingredient)
This is the method to save an ingredient to the SmartCheff database
|
LiveData<List<Ingredient>> |
selectByName(String name)
This is the method is used to get ingredients by name.
|
LiveData<List<Ingredient>> |
selectByQuantity(Ingredient quantity)
This method is used to get an ingredient by the quanity of an ingredient on hand.
|
LiveData<Ingredient> |
selectByUpc(Ingredient upc)
This method is used to find an ingredient by its upc.
|
public IngredientRepository(Context context)
context
- is a reference to a Context object.public Completable save(Ingredient ingredient)
ingredient
- si an Ingredient object.public Completable delete(Ingredient ingredient)
ingredient
- is an ingredient object.public LiveData<List<Ingredient>> getAll()
public LiveData<List<Ingredient>> selectByName(String name)
name
- is a String and is used as the name of an ingredient.public LiveData<Ingredient> selectByUpc(Ingredient upc)
upc
- is the upc of a specific ingredient.public LiveData<List<Ingredient>> selectByQuantity(Ingredient quantity)
quantity
- is the amount of an ingredient on hand.