# Google Data APIs Client Library (1.43.0)

## com.google.gdata.data.analytics
Class Metric

    java.lang.Object
      com.google.gdata.data.AbstractExtension
          com.google.gdata.data.ExtensionPoint
              com.google.gdata.data.analytics.Metric

All Implemented Interfaces:
  Extension

    public class Metric

extends ExtensionPoint

Metric value.

Nested Class Summary
`static class` `Metric.Type` The format of data represented by the metric.

Nested classes/interfaces inherited from class com.google.gdata.data.ExtensionPoint
`ExtensionPoint.CumulativeBlobHandler, ExtensionPoint.ExtensionHandler`

Nested classes/interfaces inherited from class com.google.gdata.data.AbstractExtension
`AbstractExtension.AttributesHandler`

Field Summary

Fields inherited from class com.google.gdata.data.ExtensionPoint
`xmlBlob`

Fields inherited from class com.google.gdata.data.AbstractExtension
`localName, namespace`

Constructor Summary
`Metric()` Default mutable constructor.
`Metric(java.lang.Double confidenceInterval, java.lang.String name, java.lang.String type, java.lang.String value)` Immutable constructor.

Method Summary
`protected void` `consumeAttributes(AttributeHelper helper)` Consumes attributes from the attribute helper.
`double` `doubleValue()` Gets the double value of this metric.
`boolean` `equals(java.lang.Object obj)`
`java.lang.Double` `getConfidenceInterval()` Returns the 95% confidence interval for this metric (lower is better).
`static ExtensionDescription` `getDefaultDescription(boolean required, boolean repeatable)` Returns the extension description, specifying whether it is required, and whether it is repeatable.
`java.lang.String` `getName()` Returns the name.
`java.lang.String` `getType()` Returns the the format of data represented by the metric.
`java.lang.String` `getValue()` Returns the value.
`boolean` `hasConfidenceInterval()` Returns whether it has the 95% confidence interval for this metric (lower is better).
`int` `hashCode()`
`boolean` `hasName()` Returns whether it has the name.
`boolean` `hasType()` Returns whether it has the the format of data represented by the metric.
`boolean` `hasValue()` Returns whether it has the value.
`long` `longValue()` Gets the long value of this metric.
`java.lang.Number` `numericValue()` Gets a numeric representation of this metric's value.
`protected void` `putAttributes(AttributeGenerator generator)` Puts attributes into the attribute generator.
`void` `setConfidenceInterval(java.lang.Double confidenceInterval)` Sets the 95% confidence interval for this metric (lower is better).
`void` `setName(java.lang.String name)` Sets the name.
`void` `setType(java.lang.String type)` Sets the the format of data represented by the metric.
`void` `setValue(java.lang.String value)` Sets the value.
`java.lang.String` `toString()`
`protected void` `validate()` Checks the attributes to see if there are any problems.

Methods inherited from class com.google.gdata.data.ExtensionPoint

`addExtension, addExtension, addRepeatingExtension, addRepeatingExtension, checkRequiredExtensions, createExtensionInstance, declareExtensions, generate, generateCumulativeXmlBlob, generateExtensions, generateStartElement, getExtension, getExtensionDescription, getExtensionHandler, getExtensions, getHandler, getManifest, getRepeatingExtension, getRepeatingExtensions, getXmlBlob, hasExtension, hasRepeatingExtension, initializeArbitraryXml, parseCumulativeXmlBlob, removeExtension, removeExtension, removeRepeatingExtension, setExtension, setXmlBlob, visit, visitChild, visitChildren`

Methods inherited from class com.google.gdata.data.AbstractExtension
`disableStrictValidation, enableStrictValidation, eq, generate, generateAttributes, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Metric

    public Metric()

  Default mutable constructor.

### Metric

    public Metric(java.lang.Double confidenceInterval,
                  java.lang.String name,
                  java.lang.String type,
                  java.lang.String value)

  Immutable constructor.

  Parameters:
    `confidenceInterval` - 95% confidence interval for this metric (lower is better).
    `name` - name.
    `type` - the format of data represented by the metric.
    `value` - value.

Method Detail

### getConfidenceInterval

    public java.lang.Double getConfidenceInterval()

  Returns the 95% confidence interval for this metric (lower is better).

  Returns:
    95% confidence interval for this metric (lower is better)

### setConfidenceInterval

    public void setConfidenceInterval(java.lang.Double confidenceInterval)

  Sets the 95% confidence interval for this metric (lower is better).

  Parameters:
    `confidenceInterval` - 95% confidence interval for this metric (lower is better) or `null` to reset

### hasConfidenceInterval

    public boolean hasConfidenceInterval()

  Returns whether it has the 95% confidence interval for this metric (lower is better).

  Returns:
    whether it has the 95% confidence interval for this metric (lower is better)

### getName

    public java.lang.String getName()

  Returns the name.

  Returns:
    name

### setName

    public void setName(java.lang.String name)

  Sets the name.

  Parameters:
    `name` - name or `null` to reset

### hasName

    public boolean hasName()

  Returns whether it has the name.

  Returns:
    whether it has the name

### getType

    public java.lang.String getType()

  Returns the the format of data represented by the metric.

  Returns:
    the format of data represented by the metric

### setType

    public void setType(java.lang.String type)

  Sets the the format of data represented by the metric.

  Parameters:
    `type` - the format of data represented by the metric or `null` to reset

### hasType

    public boolean hasType()

  Returns whether it has the the format of data represented by the metric.

  Returns:
    whether it has the the format of data represented by the metric

### getValue

    public java.lang.String getValue()

  Returns the value.

  Returns:
    value

### setValue

    public void setValue(java.lang.String value)

  Sets the value.

  Parameters:
    `value` - value or `null` to reset

### hasValue

    public boolean hasValue()

  Returns whether it has the value.

  Returns:
    whether it has the value

### validate

    protected void validate()

  Description copied from class: `AbstractExtension`
  Checks the attributes to see if there are any problems. Default implementation does nothing, though generally this is discouraged unless there really are no restrictions.

  Overrides:
    `validate` in class `AbstractExtension`

### getDefaultDescription

    public static ExtensionDescription getDefaultDescription(boolean required,
                                                             boolean repeatable)

  Returns the extension description, specifying whether it is required, and whether it is repeatable.

  Parameters:
    `required` - whether it is required
    `repeatable` - whether it is repeatable
  Returns:
    extension description

### putAttributes

    protected void putAttributes(AttributeGenerator generator)

  Description copied from class: `AbstractExtension`
  Puts attributes into the attribute generator. Called from `AbstractExtension.generate(XmlWriter,ExtensionProfile)`. Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

  Overrides:
    `putAttributes` in class `AbstractExtension`
  Parameters:
    `generator` - attribute generator

### consumeAttributes

    protected void consumeAttributes(AttributeHelper helper)
                              throws ParseException

  Description copied from class: `AbstractExtension`
  Consumes attributes from the attribute helper. May also use `AttributeHelper.consumeContent(boolean)` to consume the element's text content. Called from `AbstractExtension.getHandler(com.google.gdata.data.ExtensionProfile, java.lang.String, java.lang.String, org.xml.sax.Attributes)`. Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

  Overrides:
    `consumeAttributes` in class `AbstractExtension`
  Parameters:
    `helper` - attribute helper
  Throws:
    `ParseException` - any parsing exception

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### numericValue

    public java.lang.Number numericValue()

  Gets a numeric representation of this metric's value. The exact subclass of Number returned can be determined by the result of getType(): if getType() returns `"integer"` then the value returned by this method is an instance of java.lang.Integer; otherwise it is an instance of java.lang.Double.

  Returns:
    A numeric representation of the value of this metric
  Throws:
    `java.lang.NumberFormatException` - If the value of this metric cannot be parsed into the the most appropriate numeric format for its type

### longValue

    public long longValue()

  Gets the long value of this metric. If the underlying data is a floating-point number, then the number returned by this method is the result of casting that floating-point number to type long.

### doubleValue

    public double doubleValue()

  Gets the double value of this metric. If the underlying data is an integer value, then the number returned by this method is the result of casting that integer to type double.