Class Nutrient
java.lang.Object
com.codename1.health.nutrition.Nutrient
A single nutrient that a NutritionSample can carry -- a macronutrient,
a vitamin, a mineral.
Interned constants, like HealthDataType, so ==
is a valid identity test and forId(String) stays total across
framework versions.
Each nutrient declares the unit its amounts are expressed in. That is not cosmetic: sodium is conventionally logged in milligrams and protein in grams, and a food database that mixes them up is off by a thousand.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final NutrientFood energy.static final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrientstatic final Nutrient -
Method Summary
Modifier and TypeMethodDescriptionstatic NutrientLooks a nutrient up bygetId(), ornullwhen unknown to this version of the framework.getId()The stable, portable identifier for this nutrient.getUnit()The unit amounts of this nutrient are expressed in.toString()Returns a string representation of the object.values()Every nutrient this framework understands.
-
Field Details
-
ENERGY
Food energy. Note that this is also available as a standalone type,HealthDataType.DIETARY_ENERGY; writing aNutritionSamplethat carries it makes it part of a logged meal rather than a bare total. -
PROTEIN
-
TOTAL_FAT
-
SATURATED_FAT
-
MONOUNSATURATED_FAT
-
POLYUNSATURATED_FAT
-
TRANS_FAT
-
CHOLESTEROL
-
TOTAL_CARBOHYDRATE
-
DIETARY_FIBER
-
SUGAR
-
WATER
-
SODIUM
-
POTASSIUM
-
CALCIUM
-
IRON
-
MAGNESIUM
-
ZINC
-
PHOSPHORUS
-
IODINE
-
SELENIUM
-
COPPER
-
MANGANESE
-
CHROMIUM
-
MOLYBDENUM
-
CHLORIDE
-
VITAMIN_A
-
THIAMIN
-
RIBOFLAVIN
-
NIACIN
-
PANTOTHENIC_ACID
-
VITAMIN_B6
-
BIOTIN
-
VITAMIN_B12
-
VITAMIN_C
-
VITAMIN_D
-
VITAMIN_E
-
VITAMIN_K
-
FOLATE
-
CAFFEINE
-
-
Method Details
-
getId
The stable, portable identifier for this nutrient. -
getUnit
The unit amounts of this nutrient are expressed in. -
forId
-
values
-
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-