public final class NutritionLog extends GeneratedMessage implements NutritionLogOrBuilder
Holds information about a user logged food.
There are two ways of creating a nutrition log based on the food type:
- Identified food: Using the food field, which is a reference to a Food
resource. In this case fields
nutrients, energy, energy_from_fat,
total_carbohydrate, total_fat, food_display_name will be populated
based on the referenced food.
Anonymous food: Using the food_display_name field and setting
the nutrients, energy, energy_from_fat, total_carbohydrate,
total_fat fields manually.
The identified food is preferred over the anonymous food.
Nutrition logs created from anonymous food are not be editable.
Protobuf type google.devicesandservices.health.v4.NutritionLog
Inherited Members
com.google.protobuf.GeneratedMessage.<ContainingT,T>newFileScopedGeneratedExtension(java.lang.Class<?>,com.google.protobuf.Message)
com.google.protobuf.GeneratedMessage.<ContainingT,T>newMessageScopedGeneratedExtension(com.google.protobuf.Message,int,java.lang.Class<?>,com.google.protobuf.Message)
com.google.protobuf.GeneratedMessage.<ListT>makeMutableCopy(ListT)
com.google.protobuf.GeneratedMessage.<ListT>makeMutableCopy(ListT,int)
com.google.protobuf.GeneratedMessage.<T>emptyList(java.lang.Class<T>)
com.google.protobuf.GeneratedMessage.<V>serializeBooleanMapTo(com.google.protobuf.CodedOutputStream,com.google.protobuf.MapField<java.lang.Boolean,V>,com.google.protobuf.MapEntry<java.lang.Boolean,V>,int)
com.google.protobuf.GeneratedMessage.<V>serializeIntegerMapTo(com.google.protobuf.CodedOutputStream,com.google.protobuf.MapField<java.lang.Integer,V>,com.google.protobuf.MapEntry<java.lang.Integer,V>,int)
com.google.protobuf.GeneratedMessage.<V>serializeLongMapTo(com.google.protobuf.CodedOutputStream,com.google.protobuf.MapField<java.lang.Long,V>,com.google.protobuf.MapEntry<java.lang.Long,V>,int)
com.google.protobuf.GeneratedMessage.<V>serializeStringMapTo(com.google.protobuf.CodedOutputStream,com.google.protobuf.MapField<java.lang.String,V>,com.google.protobuf.MapEntry<java.lang.String,V>,int)
com.google.protobuf.GeneratedMessage.canUseUnsafe()
com.google.protobuf.GeneratedMessage.emptyBooleanList()
com.google.protobuf.GeneratedMessage.emptyDoubleList()
com.google.protobuf.GeneratedMessage.emptyFloatList()
com.google.protobuf.GeneratedMessage.emptyIntList()
com.google.protobuf.GeneratedMessage.emptyLongList()
com.google.protobuf.GeneratedMessage.internalGetMapFieldReflection(int)
com.google.protobuf.GeneratedMessage.isStringEmpty(java.lang.Object)
com.google.protobuf.GeneratedMessage.mergeFromAndMakeImmutableInternal(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite)
com.google.protobuf.GeneratedMessage.newInstance(com.google.protobuf.GeneratedMessage.UnusedPrivateParameter)
com.google.protobuf.GeneratedMessage.parseUnknownFieldProto3(com.google.protobuf.CodedInputStream,com.google.protobuf.UnknownFieldSet.Builder,com.google.protobuf.ExtensionRegistryLite,int)
Static Fields
ENERGY_FIELD_NUMBER
public static final int ENERGY_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
ENERGY_FROM_FAT_FIELD_NUMBER
public static final int ENERGY_FROM_FAT_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
FOOD_DISPLAY_NAME_FIELD_NUMBER
public static final int FOOD_DISPLAY_NAME_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
FOOD_FIELD_NUMBER
public static final int FOOD_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
INTERVAL_FIELD_NUMBER
public static final int INTERVAL_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
MEAL_TYPE_FIELD_NUMBER
public static final int MEAL_TYPE_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
NUTRIENTS_FIELD_NUMBER
public static final int NUTRIENTS_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
SERVING_FIELD_NUMBER
public static final int SERVING_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
TOTAL_CARBOHYDRATE_FIELD_NUMBER
public static final int TOTAL_CARBOHYDRATE_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
TOTAL_FAT_FIELD_NUMBER
public static final int TOTAL_FAT_FIELD_NUMBER
| Field Value |
| Type |
Description |
int |
|
Static Methods
getDefaultInstance()
public static NutritionLog getDefaultInstance()
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
newBuilder()
public static NutritionLog.Builder newBuilder()
newBuilder(NutritionLog prototype)
public static NutritionLog.Builder newBuilder(NutritionLog prototype)
public static NutritionLog parseDelimitedFrom(InputStream input)
public static NutritionLog parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
parseFrom(byte[] data)
public static NutritionLog parseFrom(byte[] data)
| Parameter |
| Name |
Description |
data |
byte[]
|
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static NutritionLog parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
parseFrom(ByteString data)
public static NutritionLog parseFrom(ByteString data)
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static NutritionLog parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static NutritionLog parseFrom(CodedInputStream input)
public static NutritionLog parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public static NutritionLog parseFrom(InputStream input)
public static NutritionLog parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
parseFrom(ByteBuffer data)
public static NutritionLog parseFrom(ByteBuffer data)
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static NutritionLog parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
parser()
public static Parser<NutritionLog> parser()
Methods
equals(Object obj)
public boolean equals(Object obj)
| Parameter |
| Name |
Description |
obj |
Object
|
Overrides
getDefaultInstanceForType()
public NutritionLog getDefaultInstanceForType()
getEnergy()
public EnergyQuantity getEnergy()
Optional. Value representing the energy of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy = 4 [(.google.api.field_behavior) = OPTIONAL];
getEnergyFromFat()
public EnergyQuantity getEnergyFromFat()
Optional. Value representing the energy from fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy_from_fat = 5 [(.google.api.field_behavior) = OPTIONAL];
getEnergyFromFatOrBuilder()
public EnergyQuantityOrBuilder getEnergyFromFatOrBuilder()
Optional. Value representing the energy from fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy_from_fat = 5 [(.google.api.field_behavior) = OPTIONAL];
getEnergyOrBuilder()
public EnergyQuantityOrBuilder getEnergyOrBuilder()
Optional. Value representing the energy of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy = 4 [(.google.api.field_behavior) = OPTIONAL];
getFood()
Required. Represents the food ID.
string food = 15 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Returns |
| Type |
Description |
String |
The food.
|
getFoodBytes()
public ByteString getFoodBytes()
Required. Represents the food ID.
string food = 15 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
| Returns |
| Type |
Description |
ByteString |
The bytes for food.
|
getFoodDisplayName()
public String getFoodDisplayName()
Value representing the display name of the food.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
string food_display_name = 16;
| Returns |
| Type |
Description |
String |
The foodDisplayName.
|
getFoodDisplayNameBytes()
public ByteString getFoodDisplayNameBytes()
Value representing the display name of the food.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
string food_display_name = 16;
| Returns |
| Type |
Description |
ByteString |
The bytes for foodDisplayName.
|
getInterval()
public SessionTimeInterval getInterval()
Required. Observed interval.
.google.devicesandservices.health.v4.SessionTimeInterval interval = 2 [(.google.api.field_behavior) = REQUIRED];
getIntervalOrBuilder()
public SessionTimeIntervalOrBuilder getIntervalOrBuilder()
Required. Observed interval.
.google.devicesandservices.health.v4.SessionTimeInterval interval = 2 [(.google.api.field_behavior) = REQUIRED];
getMealType()
public MealType getMealType()
Optional. Value representing the meal type of the nutrition log.
.google.devicesandservices.health.v4.MealType meal_type = 13 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
MealType |
The mealType.
|
getMealTypeValue()
public int getMealTypeValue()
Optional. Value representing the meal type of the nutrition log.
.google.devicesandservices.health.v4.MealType meal_type = 13 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
int |
The enum numeric value on the wire for mealType.
|
getNutrients(int index)
public NutrientQuantity getNutrients(int index)
Optional. Value representing the nutrients of the nutrition log.
repeated .google.devicesandservices.health.v4.NutrientQuantity nutrients = 3 [(.google.api.field_behavior) = OPTIONAL];
| Parameter |
| Name |
Description |
index |
int
|
getNutrientsCount()
public int getNutrientsCount()
Optional. Value representing the nutrients of the nutrition log.
repeated .google.devicesandservices.health.v4.NutrientQuantity nutrients = 3 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
int |
|
getNutrientsList()
public List<NutrientQuantity> getNutrientsList()
Optional. Value representing the nutrients of the nutrition log.
repeated .google.devicesandservices.health.v4.NutrientQuantity nutrients = 3 [(.google.api.field_behavior) = OPTIONAL];
getNutrientsOrBuilder(int index)
public NutrientQuantityOrBuilder getNutrientsOrBuilder(int index)
Optional. Value representing the nutrients of the nutrition log.
repeated .google.devicesandservices.health.v4.NutrientQuantity nutrients = 3 [(.google.api.field_behavior) = OPTIONAL];
| Parameter |
| Name |
Description |
index |
int
|
getNutrientsOrBuilderList()
public List<? extends NutrientQuantityOrBuilder> getNutrientsOrBuilderList()
Optional. Value representing the nutrients of the nutrition log.
repeated .google.devicesandservices.health.v4.NutrientQuantity nutrients = 3 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
List<? extends com.google.devicesandservices.health.v4.NutrientQuantityOrBuilder> |
|
getParserForType()
public Parser<NutritionLog> getParserForType()
Overrides
getSerializedSize()
public int getSerializedSize()
| Returns |
| Type |
Description |
int |
|
Overrides
getServing()
public NutritionLog.Serving getServing()
Optional. Value representing the nutrition log serving.
.google.devicesandservices.health.v4.NutritionLog.Serving serving = 14 [(.google.api.field_behavior) = OPTIONAL];
getServingOrBuilder()
public NutritionLog.ServingOrBuilder getServingOrBuilder()
Optional. Value representing the nutrition log serving.
.google.devicesandservices.health.v4.NutritionLog.Serving serving = 14 [(.google.api.field_behavior) = OPTIONAL];
getTotalCarbohydrate()
public WeightQuantity getTotalCarbohydrate()
Optional. Value representing the total carbohydrate of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_carbohydrate = 7 [(.google.api.field_behavior) = OPTIONAL];
getTotalCarbohydrateOrBuilder()
public WeightQuantityOrBuilder getTotalCarbohydrateOrBuilder()
Optional. Value representing the total carbohydrate of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_carbohydrate = 7 [(.google.api.field_behavior) = OPTIONAL];
getTotalFat()
public WeightQuantity getTotalFat()
Optional. Value representing the total fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_fat = 8 [(.google.api.field_behavior) = OPTIONAL];
getTotalFatOrBuilder()
public WeightQuantityOrBuilder getTotalFatOrBuilder()
Optional. Value representing the total fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_fat = 8 [(.google.api.field_behavior) = OPTIONAL];
hasEnergy()
public boolean hasEnergy()
Optional. Value representing the energy of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy = 4 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
boolean |
Whether the energy field is set.
|
hasEnergyFromFat()
public boolean hasEnergyFromFat()
Optional. Value representing the energy from fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.EnergyQuantity energy_from_fat = 5 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
boolean |
Whether the energyFromFat field is set.
|
hasInterval()
public boolean hasInterval()
Required. Observed interval.
.google.devicesandservices.health.v4.SessionTimeInterval interval = 2 [(.google.api.field_behavior) = REQUIRED];
| Returns |
| Type |
Description |
boolean |
Whether the interval field is set.
|
hasServing()
public boolean hasServing()
Optional. Value representing the nutrition log serving.
.google.devicesandservices.health.v4.NutritionLog.Serving serving = 14 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
boolean |
Whether the serving field is set.
|
hasTotalCarbohydrate()
public boolean hasTotalCarbohydrate()
Optional. Value representing the total carbohydrate of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_carbohydrate = 7 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
boolean |
Whether the totalCarbohydrate field is set.
|
hasTotalFat()
public boolean hasTotalFat()
Optional. Value representing the total fat of the nutrition log.
For nutrition logs created from an identified food, this field will be
populated based on the referenced food. For anonymous food, this field will
be populated manually.
.google.devicesandservices.health.v4.WeightQuantity total_fat = 8 [(.google.api.field_behavior) = OPTIONAL];
| Returns |
| Type |
Description |
boolean |
Whether the totalFat field is set.
|
hashCode()
| Returns |
| Type |
Description |
int |
|
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
Overrides
isInitialized()
public final boolean isInitialized()
Overrides
newBuilderForType()
public NutritionLog.Builder newBuilderForType()
newBuilderForType(AbstractMessage.BuilderParent parent)
protected NutritionLog.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
Overrides
toBuilder()
public NutritionLog.Builder toBuilder()
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Overrides