|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.spaz.cron.datasource.AbstractFoodDataSource
public abstract class AbstractFoodDataSource
This is a partial implementation of the IFoodDatasource
interface, providing checking for proper sources for Food
parameters and basic naming. Protected abstract implementation methods
are provided for all public methods that this class handles.
| Constructor Summary | |
|---|---|
protected |
AbstractFoodDataSource(java.lang.String name)
Construct a new instance of this class, with the name supplied. |
| Method Summary | |
|---|---|
protected void |
diffSource(Food food)
Gatekeeper method to ensure that the Food object is from
a different Datasource. |
protected abstract java.util.List |
doFindAllFoods()
Retrieve a list of all foods in this datasource. |
protected abstract java.util.List |
doFindFoods(java.lang.String[] keys)
Retrieve a List of all foods in this particular Datasource. |
protected abstract java.util.List |
doFindFoods(java.lang.String[] keys,
java.lang.String foodGroup,
java.lang.String source)
Retrieve a List of all foods in this particular Datasource having
the given food group and source. |
protected abstract java.util.List |
doGetMeasuresFor(Food food)
Return a List of Measure objects for the provided food. |
protected abstract void |
doGetNutrientsFor(Food food,
NutrientTable nutrients)
Fill the provided NutrientTable with the nutrients associated with the
Food. |
java.util.List |
findAllFoods()
Retrieve a list of all foods in this datasource. |
java.util.List |
findFoods(java.lang.String[] keys)
Retrieve a List of all foods in this particular Datasource. |
java.util.List |
findFoods(java.lang.String[] keys,
java.lang.String foodGroup,
java.lang.String source)
Retrieve a List of all foods in this particular Datasource having
the given food group and source. |
FoodDatasourceException |
getLastError()
Provides access to the last exception thrown by the underlying representation. |
java.util.List |
getMeasuresFor(Food food)
Return a List of Measure objects for the provided food. |
java.lang.String |
getName()
Retrieve the name of this datasource for use in UI components. |
void |
getNutrientsFor(Food food,
NutrientTable nutrients)
Fill the provided NutrientTable with the nutrients associated with the
Food. |
protected void |
notNull(java.lang.Object testedObject)
Gatekeeper method to ensure that an object is not null. |
protected void |
registerError(java.lang.Throwable t)
Set the last error message to the supplied Throwable. |
protected void |
sameSource(Food food)
Gatekeeper method to ensure that the Food object is from
this Datasource. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ca.spaz.cron.datasource.IFoodDatasource |
|---|
close, containsFood, getFoodGroups, getSources, initialize, isAvailable, isListable, isSearchable |
| Constructor Detail |
|---|
protected AbstractFoodDataSource(java.lang.String name)
name - the name of this datasource.| Method Detail |
|---|
protected void diffSource(Food food)
Food object is from
a different Datasource.
food - a food object to test.
java.lang.IllegalArgumentException - if the food object is from this datasource.protected void notNull(java.lang.Object testedObject)
testedObject - protected abstract java.util.List doFindAllFoods()
Food objects consisting of every food in the datasource.
UnsupportedOperationException - if the datasource does not
support listing. (if isListable() is false)protected abstract java.util.List doFindFoods(java.lang.String[] keys)
List of all foods in this particular Datasource.
keys - the keys to search on. This searches with an AND relation.
Food objects matching the criteria.
UnsupportedOperationException - if the datasource does not
support searching. (if isSearchable() is false)
protected abstract java.util.List doFindFoods(java.lang.String[] keys,
java.lang.String foodGroup,
java.lang.String source)
List of all foods in this particular Datasource having
the given food group and source.
keys - the keys to search on. This searches with an AND relation.foodGroup - the food group to search for. null to ignore.source - the source of this food item. null to ignore.
Food objects matching the criteria.
UnsupportedOperationException - if the datasource does not
support searching. (if isSearchable() is false)protected abstract java.util.List doGetMeasuresFor(Food food)
List of Measure objects for the provided food.
food - a Food object to find the measures for
List that is guaranteed to contain only Measure
objects.
protected abstract void doGetNutrientsFor(Food food,
NutrientTable nutrients)
NutrientTable with the nutrients associated with the
Food.
food - The food item to load fromnutrients - the NutrientTable to fill.public final java.util.List findAllFoods()
IFoodDatasource
findAllFoods in interface IFoodDatasourceFood objects consisting of every food in the datasource.public final java.util.List findFoods(java.lang.String[] keys)
IFoodDatasourceList of all foods in this particular Datasource.
findFoods in interface IFoodDatasourcekeys - the keys to search on. This searches with an AND relation.
Food objects matching the criteria.
public final java.util.List findFoods(java.lang.String[] keys,
java.lang.String foodGroup,
java.lang.String source)
IFoodDatasourceList of all foods in this particular Datasource having
the given food group and source.
findFoods in interface IFoodDatasourcekeys - the keys to search on. This searches with an AND relation.foodGroup - the food group to search for. null to ignore.source - the source of this food item. null to ignore.
Food objects matching the criteria.public final java.util.List getMeasuresFor(Food food)
IFoodDatasourceList of Measure objects for the provided food.
getMeasuresFor in interface IFoodDatasourcefood - a Food object to find the measures for
List that is guaranteed to contain only Measure
objects.public java.lang.String getName()
IFoodDatasource
getName in interface IFoodDatasource
public final void getNutrientsFor(Food food,
NutrientTable nutrients)
IFoodDatasourceNutrientTable with the nutrients associated with the
Food.
getNutrientsFor in interface IFoodDatasourcefood - The food item to load fromnutrients - the NutrientTable to fill.protected void sameSource(Food food)
Food object is from
this Datasource.
food - a food object to test.
java.lang.IllegalArgumentException - if the food object is from another datasource.public final java.lang.String toString()
toString in class java.lang.Objectpublic FoodDatasourceException getLastError()
IFoodDatasource
getLastError in interface IFoodDatasourceThrowable that an implementation of this interface
has thrown.protected void registerError(java.lang.Throwable t)
t - the exception that just happened.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||