Class JsonNumber

java.lang.Object
name.martingeisse.grumpyjson.json_model.JsonElement
name.martingeisse.grumpyjson.json_model.JsonNumber

public final class JsonNumber extends JsonElement
This class represents JSON numbers.
  • Method Details

    • of

      public static JsonNumber of(Number value)
      Creates an instance of this class for the specified plain numeric value.

      To guarantee immutability of the whole JSON structure, the argument must be an immutable Number instance itself.

      Parameters:
      value - the numeric value -- must be immutable
      Returns:
      the JSON number
    • getValue

      public Number getValue()
      Getter method.
      Returns:
      the value of this JSON number
    • deserializerExpectsNumber

      public Number deserializerExpectsNumber()
      Description copied from class: JsonElement
      If this JSON element is not a JSON number, this method throws a JsonDeserializationException, otherwise it returns the numeric value.
      Overrides:
      deserializerExpectsNumber in class JsonElement
      Returns:
      the numeric value
    • equals

      public boolean equals(Object otherObject)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object