java.lang.Object
com.espertech.esper.common.client.json.minimaljson.JsonValue
com.espertech.esper.common.client.json.minimaljson.JsonNumber
All Implemented Interfaces:
Serializable

public class JsonNumber extends JsonValue
JSON number.
See Also:
  • Constructor Details

    • JsonNumber

      public JsonNumber(String string)
      Ctor.
      Parameters:
      string - value
  • Method Details

    • toString

      public String toString()
      Description copied from class: JsonValue
      Returns the JSON string for this value in its minimal form, without any additional whitespace. The result is guaranteed to be a valid input for the method Json.parse(String) and to create a value that is equal to this object.
      Overrides:
      toString in class JsonValue
      Returns:
      a JSON string that represents this value
    • isNumber

      public boolean isNumber()
      Description copied from class: JsonValue
      Detects whether this value represents a JSON number.
      Overrides:
      isNumber in class JsonValue
      Returns:
      true if this value represents a JSON number
    • asInt

      public int asInt()
      Description copied from class: JsonValue
      Returns this JSON value as an int value, assuming that this value represents a JSON number that can be interpreted as Java int. If this is not the case, an exception is thrown.

      To be interpreted as Java int, the JSON number must neither contain an exponent nor a fraction part. Moreover, the number must be in the Integer range.

      Overrides:
      asInt in class JsonValue
      Returns:
      this value as int
    • asLong

      public long asLong()
      Description copied from class: JsonValue
      Returns this JSON value as a long value, assuming that this value represents a JSON number that can be interpreted as Java long. If this is not the case, an exception is thrown.

      To be interpreted as Java long, the JSON number must neither contain an exponent nor a fraction part. Moreover, the number must be in the Long range.

      Overrides:
      asLong in class JsonValue
      Returns:
      this value as long
    • asFloat

      public float asFloat()
      Description copied from class: JsonValue
      Returns this JSON value as a float value, assuming that this value represents a JSON number. If this is not the case, an exception is thrown.

      If the JSON number is out of the Float range, Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY is returned.

      Overrides:
      asFloat in class JsonValue
      Returns:
      this value as float
    • asDouble

      public double asDouble()
      Description copied from class: JsonValue
      Returns this JSON value as a double value, assuming that this value represents a JSON number. If this is not the case, an exception is thrown.

      If the JSON number is out of the Double range, Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY is returned.

      Overrides:
      asDouble in class JsonValue
      Returns:
      this value as double
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class JsonValue
    • equals

      public boolean equals(Object object)
      Description copied from class: JsonValue
      Indicates whether some other object is "equal to" this one according to the contract specified in Object.equals(Object).

      Two JsonValues are considered equal if and only if they represent the same JSON text. As a consequence, two given JsonObjects may be different even though they contain the same set of names with the same values, but in a different order.

      Overrides:
      equals in class JsonValue
      Parameters:
      object - the reference object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise