Class JreJsonArray

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean asBoolean()
      Coerces underlying value to boolean according to the rules of Javascript coercion.
      double asNumber()
      Coerces the underlying value to a number according to the rules of Javascript coercion.
      String asString()
      Coerces the underlying value to a String according to the rules of JavaScript coercion.
      JsonValue get​(int index)
      Return the ith element of the array.
      JsonArray getArray​(int index)
      Return the ith element of the array (uncoerced) as a JsonArray.
      boolean getBoolean​(int index)
      Return the ith element of the array (uncoerced) as a boolean.
      double getNumber​(int index)
      Return the ith element of the array (uncoerced) as a number.
      Object getObject()  
      JsonObject getObject​(int index)
      Return the ith element of the array (uncoerced) as a JsonObject If the type is not an object,, this can result in runtime errors.
      String getString​(int index)
      Return the ith element of the array (uncoerced) as a String.
      JsonType getType()
      Returns an enumeration representing the fundamental JSON type.
      boolean jsEquals​(JsonValue value)
      Equivalent of Javascript '==' operator comparison between two values.
      int length()
      Length of the array.
      void remove​(int index)
      Remove an element of the array at a particular index.
      void set​(int index, boolean bool)
      Set the value at index to be a boolean value.
      void set​(int index, double number)
      Set the value at index to be a number value.
      void set​(int index, JsonValue value)
      Set the value at index to be a given value.
      void set​(int index, String string)
      Set the value at index to be a String value.
      String toJson()
      Returns a serialized JSON string representing this value.
      void traverse​(elemental.json.impl.JsonVisitor visitor, elemental.json.impl.JsonContext ctx)  
    • Constructor Detail

      • JreJsonArray

        public JreJsonArray​(JsonFactory factory)
    • Method Detail

      • asBoolean

        public boolean asBoolean()
        Description copied from interface: JsonValue
        Coerces underlying value to boolean according to the rules of Javascript coercion.
        Specified by:
        asBoolean in interface JsonValue
      • asNumber

        public double asNumber()
        Description copied from interface: JsonValue
        Coerces the underlying value to a number according to the rules of Javascript coercion.
        Specified by:
        asNumber in interface JsonValue
      • asString

        public String asString()
        Description copied from interface: JsonValue
        Coerces the underlying value to a String according to the rules of JavaScript coercion.
        Specified by:
        asString in interface JsonValue
      • get

        public JsonValue get​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array.
        Specified by:
        get in interface JsonArray
      • getArray

        public JsonArray getArray​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array (uncoerced) as a JsonArray. If the type is not an array, this can result in runtime errors.
        Specified by:
        getArray in interface JsonArray
      • getBoolean

        public boolean getBoolean​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array (uncoerced) as a boolean. If the type is not a boolean, this can result in runtime errors.
        Specified by:
        getBoolean in interface JsonArray
      • getNumber

        public double getNumber​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array (uncoerced) as a number. If the type is not a number, this can result in runtime errors.
        Specified by:
        getNumber in interface JsonArray
      • getObject

        public JsonObject getObject​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array (uncoerced) as a JsonObject If the type is not an object,, this can result in runtime errors.
        Specified by:
        getObject in interface JsonArray
      • getString

        public String getString​(int index)
        Description copied from interface: JsonArray
        Return the ith element of the array (uncoerced) as a String. If the type is not a String, this can result in runtime errors.
        Specified by:
        getString in interface JsonArray
      • getType

        public JsonType getType()
        Description copied from interface: JsonValue
        Returns an enumeration representing the fundamental JSON type.
        Specified by:
        getType in interface JsonValue
      • jsEquals

        public boolean jsEquals​(JsonValue value)
        Description copied from interface: JsonValue
        Equivalent of Javascript '==' operator comparison between two values.
        Specified by:
        jsEquals in interface JsonValue
      • length

        public int length()
        Description copied from interface: JsonArray
        Length of the array.
        Specified by:
        length in interface JsonArray
      • remove

        public void remove​(int index)
        Description copied from interface: JsonArray
        Remove an element of the array at a particular index.
        Specified by:
        remove in interface JsonArray
      • set

        public void set​(int index,
                        JsonValue value)
        Description copied from interface: JsonArray
        Set the value at index to be a given value.
        Specified by:
        set in interface JsonArray
      • set

        public void set​(int index,
                        String string)
        Description copied from interface: JsonArray
        Set the value at index to be a String value.
        Specified by:
        set in interface JsonArray
      • set

        public void set​(int index,
                        double number)
        Description copied from interface: JsonArray
        Set the value at index to be a number value.
        Specified by:
        set in interface JsonArray
      • set

        public void set​(int index,
                        boolean bool)
        Description copied from interface: JsonArray
        Set the value at index to be a boolean value.
        Specified by:
        set in interface JsonArray
      • toJson

        public String toJson()
        Description copied from interface: JsonValue
        Returns a serialized JSON string representing this value.
        Specified by:
        toJson in interface JsonValue
        Returns:
      • traverse

        public void traverse​(elemental.json.impl.JsonVisitor visitor,
                             elemental.json.impl.JsonContext ctx)
        Specified by:
        traverse in class JreJsonValue