# Class Nutrient

java.lang.Object
com.codename1.health.nutrition.Nutrient

public final class Nutrient extends Object

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

  Fields
  Modifier and Type
  Field
  Description
  `static final Nutrient`
  `BIOTIN`
  `static final Nutrient`
  `CAFFEINE`
  `static final Nutrient`
  `CALCIUM`
  `static final Nutrient`
  `CHLORIDE`
  `static final Nutrient`
  `CHOLESTEROL`
  `static final Nutrient`
  `CHROMIUM`
  `static final Nutrient`
  `COPPER`
  `static final Nutrient`
  `DIETARY_FIBER`
  `static final Nutrient`
  `ENERGY`
  Food energy.
  `static final Nutrient`
  `FOLATE`
  `static final Nutrient`
  `IODINE`
  `static final Nutrient`
  `IRON`
  `static final Nutrient`
  `MAGNESIUM`
  `static final Nutrient`
  `MANGANESE`
  `static final Nutrient`
  `MOLYBDENUM`
  `static final Nutrient`
  `MONOUNSATURATED_FAT`
  `static final Nutrient`
  `NIACIN`
  `static final Nutrient`
  `PANTOTHENIC_ACID`
  `static final Nutrient`
  `PHOSPHORUS`
  `static final Nutrient`
  `POLYUNSATURATED_FAT`
  `static final Nutrient`
  `POTASSIUM`
  `static final Nutrient`
  `PROTEIN`
  `static final Nutrient`
  `RIBOFLAVIN`
  `static final Nutrient`
  `SATURATED_FAT`
  `static final Nutrient`
  `SELENIUM`
  `static final Nutrient`
  `SODIUM`
  `static final Nutrient`
  `SUGAR`
  `static final Nutrient`
  `THIAMIN`
  `static final Nutrient`
  `TOTAL_CARBOHYDRATE`
  `static final Nutrient`
  `TOTAL_FAT`
  `static final Nutrient`
  `TRANS_FAT`
  `static final Nutrient`
  `VITAMIN_A`
  `static final Nutrient`
  `VITAMIN_B12`
  `static final Nutrient`
  `VITAMIN_B6`
  `static final Nutrient`
  `VITAMIN_C`
  `static final Nutrient`
  `VITAMIN_D`
  `static final Nutrient`
  `VITAMIN_E`
  `static final Nutrient`
  `VITAMIN_K`
  `static final Nutrient`
  `WATER`
  `static final Nutrient`
  `ZINC`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Nutrient`
  `forId(String id)`
  Looks a nutrient up by `getId()`, or `null` when unknown to this version of the framework.
  `String`
  `getId()`
  The stable, portable identifier for this nutrient.
  `HealthUnit`
  `getUnit()`
  The unit amounts of this nutrient are expressed in.
  `String`
  `toString()`
  Returns a string representation of the object.
  `static List<Nutrient>`
  `values()`
  Every nutrient this framework understands.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### ENERGY

    public static final Nutrient ENERGY
    Food 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 PROTEIN

  - ### TOTAL_FAT

    public static final Nutrient TOTAL_FAT

  - ### SATURATED_FAT

    public static final Nutrient SATURATED_FAT

  - ### MONOUNSATURATED_FAT

    public static final Nutrient MONOUNSATURATED_FAT

  - ### POLYUNSATURATED_FAT

    public static final Nutrient POLYUNSATURATED_FAT

  - ### TRANS_FAT

    public static final Nutrient TRANS_FAT

  - ### CHOLESTEROL

    public static final Nutrient CHOLESTEROL

  - ### TOTAL_CARBOHYDRATE

    public static final Nutrient TOTAL_CARBOHYDRATE

  - ### DIETARY_FIBER

    public static final Nutrient DIETARY_FIBER

  - ### SUGAR

    public static final Nutrient SUGAR

  - ### WATER

    public static final Nutrient WATER

  - ### SODIUM

    public static final Nutrient SODIUM

  - ### POTASSIUM

    public static final Nutrient POTASSIUM

  - ### CALCIUM

    public static final Nutrient CALCIUM

  - ### IRON

    public static final Nutrient IRON

  - ### MAGNESIUM

    public static final Nutrient MAGNESIUM

  - ### ZINC

    public static final Nutrient ZINC

  - ### PHOSPHORUS

    public static final Nutrient PHOSPHORUS

  - ### IODINE

    public static final Nutrient IODINE

  - ### SELENIUM

    public static final Nutrient SELENIUM

  - ### COPPER

    public static final Nutrient COPPER

  - ### MANGANESE

    public static final Nutrient MANGANESE

  - ### CHROMIUM

    public static final Nutrient CHROMIUM

  - ### MOLYBDENUM

    public static final Nutrient MOLYBDENUM

  - ### CHLORIDE

    public static final Nutrient CHLORIDE

  - ### VITAMIN_A

    public static final Nutrient VITAMIN_A

  - ### THIAMIN

    public static final Nutrient THIAMIN

  - ### RIBOFLAVIN

    public static final Nutrient RIBOFLAVIN

  - ### NIACIN

    public static final Nutrient NIACIN

  - ### PANTOTHENIC_ACID

    public static final Nutrient PANTOTHENIC_ACID

  - ### VITAMIN_B6

    public static final Nutrient VITAMIN_B6

  - ### BIOTIN

    public static final Nutrient BIOTIN

  - ### VITAMIN_B12

    public static final Nutrient VITAMIN_B12

  - ### VITAMIN_C

    public static final Nutrient VITAMIN_C

  - ### VITAMIN_D

    public static final Nutrient VITAMIN_D

  - ### VITAMIN_E

    public static final Nutrient VITAMIN_E

  - ### VITAMIN_K

    public static final Nutrient VITAMIN_K

  - ### FOLATE

    public static final Nutrient FOLATE

  - ### CAFFEINE

    public static final Nutrient CAFFEINE

- ## Method 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()
    Description copied from class: `Object`
    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())
    Overrides:
      `toString` in class `Object`