cc.plural.jsonij
Class NumericImp

java.lang.Object
  extended by cc.plural.jsonij.Value
      extended by cc.plural.jsonij.NumericImp
All Implemented Interfaces:
Serializable, Comparable<Value>
Direct Known Subclasses:
JSON.Numeric

public class NumericImp
extends Value
implements Serializable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class cc.plural.jsonij.Value
Value.TYPE
 
Field Summary
protected  InternalNumber internalNumberData
           
 
Fields inherited from class cc.plural.jsonij.Value
valueType
 
Constructor Summary
NumericImp(double value)
           
NumericImp(int value)
           
NumericImp(long value)
           
NumericImp(Number numberValue)
           
 
Method Summary
 byte byteValue()
           
 double doubleValue()
           
 boolean equals(Object obj)
           
 float floatValue()
           
 InternalNumber getNumber()
          Finds the Number representation for the Value.
 int hashCode()
           
protected  Value.TYPE internalType()
          Internal Method to find the internalType for the Object.
 int intValue()
           
 long longValue()
           
 int nestedSize()
          Finds the nested elements under this Value.
 short shortValue()
           
 String toJSON()
          Converts the current Value into a JSON String that represents it.
 
Methods inherited from class cc.plural.jsonij.Value
compareTo, get, get, getBoolean, getDouble, getInt, getString, getValueType, has, isNull, size, toString, type, valueKeySet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

internalNumberData

protected InternalNumber internalNumberData
Constructor Detail

NumericImp

public NumericImp(int value)

NumericImp

public NumericImp(long value)

NumericImp

public NumericImp(double value)

NumericImp

public NumericImp(Number numberValue)
Method Detail

internalType

protected Value.TYPE internalType()
Description copied from class: Value
Internal Method to find the internalType for the Object. Must be implemented and not return null.

Specified by:
internalType in class Value
Returns:
The internalType of this JSON Value.

byteValue

public byte byteValue()

doubleValue

public double doubleValue()

floatValue

public float floatValue()

intValue

public int intValue()

longValue

public long longValue()

shortValue

public short shortValue()

getNumber

public InternalNumber getNumber()
Description copied from class: Value
Finds the Number representation for the Value. Returns 1D when the value is JSON True and 0D when the value is JSON False. When the value is Numeric it will return the Number. If the value is a String then an attempt is made to parse the String value into an Double and return it. All other types return -1D.

Overrides:
getNumber in class Value
Returns:
double The double value for the Value.

nestedSize

public int nestedSize()
Description copied from class: Value
Finds the nested elements under this Value. This is effectively the count of all JSON Values attached to this Value. This number does not include this value itself.

Specified by:
nestedSize in class Value
Returns:
int The count of all Values attached to this Value.

toJSON

public String toJSON()
Description copied from class: Value
Converts the current Value into a JSON String that represents it.

Specified by:
toJSON in class Value
Returns:
The JSON Value as JSON String.

equals

public boolean equals(Object obj)
Overrides:
equals in class Value

hashCode

public int hashCode()
Overrides:
hashCode in class Value


Copyright © 2012. All Rights Reserved.