Value

public final classValueextendsObject
implementsParcelable

Holder object for the value of a singlefieldin a data point.Values are not constructed directly; a value for each field of the data typeis created for each data point.

A field value has a particular format, and should be set and read using the format-specific methods. For instance, a float value should be set viasetFloat(float) and read viaasFloat(). Formats are defined as constants inField

Inherited Constant Summary

Public Method Summary

String
asActivity()
Returns the value of this object as an activity.
float
asFloat()
Returns the value of this object as a float.
int
asInt()
Returns the value of this object as an int.
String
asString()
Returns the value of this object as a string.
void
clearKey(Stringkey)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
boolean
int
getFormat()
Returns the format of this value, which matches the appropriate field in the data typedefinition.
Float
getKeyValue(Stringkey)
Returns the value of the given key in the map as aFloat.
int
boolean
isSet()
Returnstrueif this object's value has been set by calling one of the setters.
void
setActivity(Stringactivity)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
void
setFloat(float value)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
void
setInt(int value)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
void
setKeyValue(Stringkey, float value)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
void
setString(Stringvalue)
This method is deprecated. Use DataPoint.Builderto construct newDataPoint instances.
String
void
writeToParcel(Parceldest, int flags)

Inherited Method Summary

Public Methods

publicStringasActivity()

Returns the value of this object as an activity. The integer representation of the activity is converted to a String prior to returning.

Returns
Throws
IllegalStateException If thisValue does not correspond to aField.FORMAT_INT32

public floatasFloat()

Returns the value of this object as a float.

Throws
IllegalStateException If thisValue does not correspond to aField.FORMAT_FLOAT

public intasInt()

Returns the value of this object as an int.

Throws
IllegalStateException If thisValue does not correspond toField.FORMAT_INT32

publicStringasString()

Returns the value of this object as a string.

Throws
IllegalStateException If thisValue does not correspond to aField.FORMAT_STRING

public voidclearKey(Stringkey)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Clears any value currently associated with the givenkeyin the map. This method can be used only onmap values.

Parameters
key The key you're modifying.

public booleanequals(Objectother)

public intgetFormat()

Returns the format of this value, which matches the appropriate field in the data typedefinition.

Returns
  • One of the format constants fromField.

publicFloatgetKeyValue(Stringkey)

Returns the value of the given key in the map as aFloat.

Returns
  • nullif the key doesn't have a set value in the map.
Throws
IllegalStateException If thisValue does not correspond to aField.FORMAT_MAP

public inthashCode()

public booleanisSet()

Returnstrueif this object's value has been set by calling one of the setters.

public voidsetActivity(Stringactivity)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Updates this value object to represent anactivity value. Activities are internally represented as integers for storage.

Parameters
activity One of the activities fromFitnessActivities

public voidsetFloat(float value)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Updates this value object to represent a float value. Any previous values associated with this object are erased.

Parameters
value The new value that this objects holds.

public voidsetInt(int value)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Updates this value object to represent an int value. Any previous values are erased.

Parameters
value The new value that this object holds.

public voidsetKeyValue(Stringkey, float value)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Updates the value for a given key in the map to the given float value. Any previous values associated with the key are erased. This method can be used only on map values.

Key values should be kept small whenever possible. This is specially important for high frequency streams, since large keys may result in down sampling.

Parameters
key The key you're modifying.
value The new value for the given key.

public voidsetString(Stringvalue)

This method is deprecated.
UseDataPoint.Builder to construct newDataPoint instances.

Updates this value object to represent a string value. Any previous values associated with this object are erased.

String values should be kept small whenever possible. This is specially important for high frequency streams, since large values may result in down sampling.

Parameters
value The new value that this objects holds.

publicStringtoString()

public voidwriteToParcel(Parceldest, int flags)