Class LazilyParsedNumber

  • All Implemented Interfaces:
    java.io.Serializable

    public final class LazilyParsedNumber
    extends java.lang.Number
    This class holds a number value that is lazily converted to a specific number type
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String value  
    • Constructor Summary

      Constructors 
      Constructor Description
      LazilyParsedNumber​(java.lang.String value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double doubleValue()  
      boolean equals​(java.lang.Object obj)  
      float floatValue()  
      int hashCode()  
      int intValue()  
      long longValue()  
      private void readObject​(java.io.ObjectInputStream in)  
      java.lang.String toString()  
      private java.lang.Object writeReplace()
      If somebody is unlucky enough to have to serialize one of these, serialize it as a BigDecimal so that they won't need Gson on the other side to deserialize it.
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        private final java.lang.String value
    • Constructor Detail

      • LazilyParsedNumber

        public LazilyParsedNumber​(java.lang.String value)
        Parameters:
        value - must not be null
    • Method Detail

      • intValue

        public int intValue()
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public long longValue()
        Specified by:
        longValue in class java.lang.Number
      • floatValue

        public float floatValue()
        Specified by:
        floatValue in class java.lang.Number
      • doubleValue

        public double doubleValue()
        Specified by:
        doubleValue in class java.lang.Number
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • writeReplace

        private java.lang.Object writeReplace()
                                       throws java.io.ObjectStreamException
        If somebody is unlucky enough to have to serialize one of these, serialize it as a BigDecimal so that they won't need Gson on the other side to deserialize it.
        Throws:
        java.io.ObjectStreamException
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object