Class BaseIngredient
java.lang.Object
com.kosdev.kos.ext.dispense.service.ingredient.BaseIngredient
Basic abstraction of an ingredient. Ingredients are exposed
to
IngredientService using IngredientSource.
When an IngredientSource is added to
IngredientService all the ingredients in the source
will be tagged with the source object. This means that
ingredient instances can only be in a single source, and must
be in the source at the time the source is added to the service.
When IngredientService processes a source, it will change
all the ingredient id's to have the source prefix. This ensures
that id's across sources never overlap. The original id is
available via getRawId(). If the source is the default
source then no prefix is applied.
This class is typically extended to include additional properties required by a given application.
- Since:
- 1
- Version:
- 9
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()Return the id of the ingredient.getName()getRawId()Return the rawId of the ingredient id.Return theIngredientSourcethe ingredient is part of.Return theIngredientSourceid of the ingredient.getType()Return the optional compatibility type of the ingredient.voidSet the id of the ingredient.voidvoidSet the optional compatibility type of the ingredient.
-
Constructor Details
-
BaseIngredient
public BaseIngredient()Default constructor- Since:
- 1
-
-
Method Details
-
getSourceId
Return theIngredientSourceid of the ingredient.- Since:
- 1
-
getSource
Return theIngredientSourcethe ingredient is part of.- Since:
- 1
-
getId
Return the id of the ingredient. This will return the original id of the ingredient up until the ingredient source is processed byIngredientService. Once the source is added, if it is not the default source, the id will be modified to contain the sourceId as a prefix, effectively namespacing the ingredient to the source.- Since:
- 1
-
setId
Set the id of the ingredient.- Since:
- 1
-
getRawId
Return the rawId of the ingredient id. This is the original id that was assigned when the ingredient was created, before the source was processed and the sourceId was prefixed to the id.- Since:
- 9
-
getType
Return the optional compatibility type of the ingredient. This can be matched withHolder.getIngType()to help describe which ingredients are compatible with which holders. If this data is set in both holders and ingredients, the sdk and other internal services will make it easy to match ingredients to holders and perform additional validation during insertion.This is generally used to describe ingredient types like water / carb / syrup / flavor / micro / macro / etc...
- Since:
- 1
-
setType
Set the optional compatibility type of the ingredient. This can be matched withHolder.getIngType()to determine which ingredients are compatible with which holders. When used, additional validation will be performed and various sdk's will assist using this data.This is generally used to describe ingredient types like water / carb / syrup / flavor / micro / macro / etc...
- Since:
- 1
-
getName
-
setName
-