Package jodd.json
Class JsonArray
java.lang.Object
jodd.json.JsonArray
Representation of JSON array.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(byte[] value) Adds a binary value to the JSON array.Adds a boolean to the JSON array.add(CharSequence value) Adds aCharSequenceto the JSON array.Adds a double to the JSON array.Adds an enum to the JSON array.Adds a float to the JSON array.Adds an integer to the JSON array.Adds a long to the JSON array.Adds an object to the JSON array.Adds a string to the JSON array.Adds another JSON array to the JSON array.add(JsonObject value) Adds a JSON object to the JSON array.Appends all of the elements in the specified array to the end of this JSON array.addNull()Adds anullvalue to the JSON array.(package private) static booleanarrayEquals(List<?> l1, Object o2) clear()Removes all entries from the JSON array.booleanReturnstrueif given value exist.booleanbyte[]getBinary(int pos) Returns the byte[] at positionposin the array.getBoolean(int pos) Returns the boolean at positionposin the array.getDouble(int pos) Returns the double at positionposin the array.getFloat(int pos) Returns the Float at positionposin the array.getInteger(int pos) Returns the integer at positionposin the array.getJsonArray(int pos) Returns the JsonArray at positionposin the array.getJsonObject(int pos) Returns the JsonObject at positionposin the array.getLong(int pos) Returns the long at positionposin the array.getString(int pos) Returns the string at positionposin the array.getValue(int pos) Returns the object value at positionposin the array.inthashCode()booleanhasNull(int pos) Returnstrueif there is anullvalue at given index.booleanisEmpty()Returnstrueif JSON array is empty.iterator()Returns an iterator over the values in the JSON array.list()Returns the underlying list.remove(int pos) Removes the value at the specified position in the JSON array.booleanRemoves the specified value from the JSON array.intsize()Returns the number of values in this JSON array.stream()Returns a Stream over the entries in the JSON arraytoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
list
-
-
Constructor Details
-
JsonArray
public JsonArray()Creates an empty instance. -
JsonArray
Creates an instance from a List. The List is not copied.
-
-
Method Details
-
getString
Returns the string at positionposin the array. -
getInteger
Returns the integer at positionposin the array. -
getLong
Returns the long at positionposin the array. -
getDouble
Returns the double at positionposin the array. -
getFloat
Returns the Float at positionposin the array. -
getBoolean
Returns the boolean at positionposin the array. -
getJsonObject
Returns the JsonObject at positionposin the array. -
getJsonArray
Returns the JsonArray at positionposin the array. -
getBinary
public byte[] getBinary(int pos) Returns the byte[] at positionposin the array.JSON itself has no notion of a binary, so this method assumes there is a String value and it contains a Base64 encoded binary, which it decodes if found and returns.
-
getValue
Returns the object value at positionposin the array. -
hasNull
public boolean hasNull(int pos) Returnstrueif there is anullvalue at given index. -
add
Adds an enum to the JSON array.JSON has no concept of encoding Enums, so the Enum will be converted to a String using the
Enum.namemethod and the value added as a String. -
add
Adds aCharSequenceto the JSON array. -
add
Adds a string to the JSON array. -
add
Adds an integer to the JSON array. -
add
Adds a long to the JSON array. -
add
Adds a double to the JSON array. -
add
Adds a float to the JSON array. -
add
Adds a boolean to the JSON array. -
addNull
Adds anullvalue to the JSON array. -
add
Adds a JSON object to the JSON array. -
add
Adds another JSON array to the JSON array. -
add
Adds a binary value to the JSON array.JSON has no notion of binary so the binary will be base64 encoded to a String, and the String added.
-
add
Adds an object to the JSON array. -
addAll
Appends all of the elements in the specified array to the end of this JSON array. -
contains
Returnstrueif given value exist. -
remove
Removes the specified value from the JSON array. -
remove
Removes the value at the specified position in the JSON array. -
size
public int size()Returns the number of values in this JSON array. -
isEmpty
public boolean isEmpty()Returnstrueif JSON array is empty. -
list
Returns the underlying list. -
clear
Removes all entries from the JSON array. -
iterator
Returns an iterator over the values in the JSON array. -
stream
Returns a Stream over the entries in the JSON array -
toString
-
equals
-
arrayEquals
-
hashCode
public int hashCode()
-