Class Value

java.lang.Object
com.yahoo.metrics.simple.Value

public abstract class Value extends Object
Wrapper for dimension values.
Author:
steinar
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Marker for the type of the contained value of a Value instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the double wrapped by a Value if one exists.
    Show the (single) supported standard type representation of a Value instance.
    long
    Get the long wrapped by a Value if one exists.
    static Value
    of(double value)
    Helper method to wrap a double as a Value.
    static Value
    of(long value)
    Helper method to wrap a long as a Value.
    static Value
    of(String value)
    Helper method to wrap a string as a Value.
    Get the string wrapped by a Value if one exists.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Value

      public Value()
  • Method Details

    • longValue

      public long longValue() throws UnsupportedOperationException
      Get the long wrapped by a Value if one exists.
      Throws:
      UnsupportedOperationException - if LONG is not returned by {getType().
    • doubleValue

      public double doubleValue() throws UnsupportedOperationException
      Get the double wrapped by a Value if one exists.
      Throws:
      UnsupportedOperationException - if DOUBLE is not returned by {getType().
    • stringValue

      public String stringValue() throws UnsupportedOperationException
      Get the string wrapped by a Value if one exists.
      Throws:
      UnsupportedOperationException - if STRING is not returned by {getType().
    • getType

      public abstract Value.Discriminator getType()
      Show the (single) supported standard type representation of a Value instance.
    • of

      public static Value of(long value)
      Helper method to wrap a long as a Value. The instance returned may or may not be unique.
      Parameters:
      value - the value to wrap
      Returns:
      an immutable wrapper
    • of

      public static Value of(double value)
      Helper method to wrap a double as a Value. The instance returned may or may not be unique.
      Parameters:
      value - the value to wrap
      Returns:
      an immutable wrapper
    • of

      public static Value of(String value)
      Helper method to wrap a string as a Value. The instance returned may or may not be unique.
      Parameters:
      value - the value to wrap
      Returns:
      an immutable wrapper