Class Value


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

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

      Constructors 
      Constructor Description
      Value()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      double doubleValue()
      Get the double wrapped by a Value if one exists.
      abstract Value.Discriminator getType()
      Show the (single) supported standard type representation of a Value instance.
      long longValue()
      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​(java.lang.String value)
      Helper method to wrap a string as a Value.
      java.lang.String stringValue()
      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 Detail

      • Value

        public Value()
    • Method Detail

      • longValue

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

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

        public java.lang.String stringValue()
                                     throws java.lang.UnsupportedOperationException
        Get the string wrapped by a Value if one exists.
        Throws:
        java.lang.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​(java.lang.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