public final class Nutrient
- Object
- 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.
Fields
Methods
public String getId() | The stable, portable identifier for this nutrient. |
public HealthUnit getUnit() | The unit amounts of this nutrient are expressed in. |
public static Nutrient forId(String id) | Looks a nutrient up by getId(), or null when unknown to this version of the framework. |
public static List<Nutrient> values() | Every nutrient this framework understands. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Field details
ENERGY
public static final Nutrient ENERGYFood energy. Note that this is also available as a standalone type,
HealthDataType.DIETARY_ENERGY; writing a
NutritionSample that carries it makes it part of a logged meal
rather than a bare total.PROTEIN
public static final Nutrient PROTEINTOTAL_FAT
public static final Nutrient TOTAL_FATSATURATED_FAT
public static final Nutrient SATURATED_FATMONOUNSATURATED_FAT
public static final Nutrient MONOUNSATURATED_FATPOLYUNSATURATED_FAT
public static final Nutrient POLYUNSATURATED_FATTRANS_FAT
public static final Nutrient TRANS_FATCHOLESTEROL
public static final Nutrient CHOLESTEROLTOTAL_CARBOHYDRATE
public static final Nutrient TOTAL_CARBOHYDRATEDIETARY_FIBER
public static final Nutrient DIETARY_FIBERSUGAR
public static final Nutrient SUGARWATER
public static final Nutrient WATERSODIUM
public static final Nutrient SODIUMPOTASSIUM
public static final Nutrient POTASSIUMCALCIUM
public static final Nutrient CALCIUMIRON
public static final Nutrient IRONMAGNESIUM
public static final Nutrient MAGNESIUMZINC
public static final Nutrient ZINCPHOSPHORUS
public static final Nutrient PHOSPHORUSIODINE
public static final Nutrient IODINESELENIUM
public static final Nutrient SELENIUMCOPPER
public static final Nutrient COPPERMANGANESE
public static final Nutrient MANGANESECHROMIUM
public static final Nutrient CHROMIUMMOLYBDENUM
public static final Nutrient MOLYBDENUMCHLORIDE
public static final Nutrient CHLORIDEVITAMIN_A
public static final Nutrient VITAMIN_ATHIAMIN
public static final Nutrient THIAMINRIBOFLAVIN
public static final Nutrient RIBOFLAVINNIACIN
public static final Nutrient NIACINPANTOTHENIC_ACID
public static final Nutrient PANTOTHENIC_ACIDVITAMIN_B6
public static final Nutrient VITAMIN_B6BIOTIN
public static final Nutrient BIOTINVITAMIN_B12
public static final Nutrient VITAMIN_B12VITAMIN_C
public static final Nutrient VITAMIN_CVITAMIN_D
public static final Nutrient VITAMIN_DVITAMIN_E
public static final Nutrient VITAMIN_EVITAMIN_K
public static final Nutrient VITAMIN_KFOLATE
public static final Nutrient FOLATECAFFEINE
public static final Nutrient CAFFEINEMethod details
getId
public String getId()The stable, portable identifier for this nutrient.
getUnit
public HealthUnit getUnit()The unit amounts of this nutrient are expressed in.
forId
public static Nutrient forId(String id)Looks a nutrient up by
getId(), or null when unknown to this
version of the framework.values
public static List<Nutrient> values()Every nutrient this framework understands.
toString
public String toString()Returns 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())