org.directwebremoting.json.types
Class JsonNumber

java.lang.Object
  extended by org.directwebremoting.json.types.JsonValue
      extended by org.directwebremoting.json.types.JsonNumber

public class JsonNumber
extends JsonValue

The Json version of a Number

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
JsonNumber(double value)
          All JsonNumbers wrap something stored as a double
JsonNumber(int value)
          All JsonNumbers wrap something stored as a double
JsonNumber(long value)
          All JsonNumbers wrap something stored as a double
JsonNumber(java.lang.String text)
          Parse the input string as a double
 
Method Summary
 double getDouble()
          Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.
 int getInteger()
          Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.
 long getLong()
          Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.
 java.lang.String toExternalRepresentation()
          i.e.
 java.lang.String toString()
           
 
Methods inherited from class org.directwebremoting.json.types.JsonValue
getBoolean, getJsonArray, getJsonObject, getString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsonNumber

public JsonNumber(int value)
All JsonNumbers wrap something stored as a double


JsonNumber

public JsonNumber(long value)
All JsonNumbers wrap something stored as a double


JsonNumber

public JsonNumber(double value)
All JsonNumbers wrap something stored as a double


JsonNumber

public JsonNumber(java.lang.String text)
Parse the input string as a double

Method Detail

getDouble

public double getDouble()
Description copied from class: JsonValue
Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.

Overrides:
getDouble in class JsonValue
Returns:
A double representing the JsonNumber implementing this

getLong

public long getLong()
Description copied from class: JsonValue
Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.

Overrides:
getLong in class JsonValue
Returns:
A long representing the JsonNumber implementing this

getInteger

public int getInteger()
Description copied from class: JsonValue
Often when dealing with a JsonValue you know which subtype it is, this allows you to assume it is a number and get the Java value quickly.

Overrides:
getInteger in class JsonValue
Returns:
An int representing the JsonNumber implementing this

toExternalRepresentation

public java.lang.String toExternalRepresentation()
Description copied from class: JsonValue
i.e. How do we send this from one system to another?

Specified by:
toExternalRepresentation in class JsonValue
Returns:
A string representing the portable version of this data

toString

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

Copyright 2008