java.lang.Object
com.github.wnameless.json.base.JakartaJsonArray
- All Implemented Interfaces:
Jsonable,JsonArrayBase<JakartaJsonValue>,JsonArrayCore<JakartaJsonValue>,JsonSource,JsonValueBase<JakartaJsonValue>,JsonValueCore<JakartaJsonValue>,Iterable<JakartaJsonValue>
The Jakarta implementation of
JsonArrayCore.- Author:
- Wei-Ming Wu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(JsonSource jsonValue) Sets an element by givenJsonSource.asArray()Converts this to a JSON array wrapper.Converts this to a JavaBigDecimal.Converts this to a JavaBigInteger.booleanConverts this to a Java boolean.doubleasDouble()Converts this to a Java double.intasInt()Converts this to a Java int.longasLong()Converts this to a Java long.asObject()Converts this to a JSON object wrapper.asString()Converts this to a JavaString.asValue()Converts this to a JSON value wrapper.booleanget(int index) Returns a JSON value wrapper by given index.Returns a JSON elementary object.inthashCode()booleanisArray()Checks if this is represented as a JSON array.booleanChecks if this is represented as a JSON boolean.booleanisNull()Checks if this is represented as a JSON null.booleanisNumber()Checks if this is represented as a JSON number.booleanisObject()Checks if this is represented as a JSON object.booleanisString()Checks if this is represented as a JSON string.iterator()remove(int index) Removes an element by given index.voidset(int index, JsonSource jsonValue) Sets an element by given index andJsonSource.intsize()Returns the size of this JSON array.toJson()Returns a JSON string which represents this object.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.github.wnameless.json.base.JsonArrayBase
isEmpty, stream, toListMethods inherited from interface com.github.wnameless.json.base.JsonValueBase
asNull, asNumber
-
Constructor Details
-
JakartaJsonArray
public JakartaJsonArray(jakarta.json.JsonArray jsonArray)
-
-
Method Details
-
add
Description copied from interface:JsonArrayCoreSets an element by givenJsonSource.- Specified by:
addin interfaceJsonArrayCore<JakartaJsonValue>- Parameters:
jsonValue- aJsonSource
-
set
Description copied from interface:JsonArrayCoreSets an element by given index andJsonSource.- Specified by:
setin interfaceJsonArrayCore<JakartaJsonValue>- Parameters:
index- a position in this JSON arrayjsonValue- aJsonSource
-
remove
Description copied from interface:JsonArrayCoreRemoves an element by given index.- Specified by:
removein interfaceJsonArrayCore<JakartaJsonValue>- Parameters:
index- a position in this JSON array- Returns:
- the removed element
-
get
Description copied from interface:JsonArrayBaseReturns a JSON value wrapper by given index.- Specified by:
getin interfaceJsonArrayBase<JakartaJsonValue>- Parameters:
index- a position in this JSON array- Returns:
- a JSON value wrapper
-
size
public int size()Description copied from interface:JsonArrayBaseReturns the size of this JSON array.- Specified by:
sizein interfaceJsonArrayBase<JakartaJsonValue>- Returns:
- an int
-
iterator
- Specified by:
iteratorin interfaceIterable<JakartaJsonValue>
-
isObject
public boolean isObject()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON object.- Specified by:
isObjectin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON object, false otherwise
-
isArray
public boolean isArray()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON array.- Specified by:
isArrayin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON array, false otherwise
-
isString
public boolean isString()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON string.- Specified by:
isStringin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON string, false otherwise
-
isBoolean
public boolean isBoolean()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON boolean.- Specified by:
isBooleanin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON boolean, false otherwise
-
isNumber
public boolean isNumber()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON number.- Specified by:
isNumberin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON number, false otherwise
-
isNull
public boolean isNull()Description copied from interface:JsonValueBaseChecks if this is represented as a JSON null.- Specified by:
isNullin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- true if this is represented as a JSON null, false otherwise
-
asString
Description copied from interface:JsonValueBaseConverts this to a JavaString.- Specified by:
asStringin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a
String
-
asBoolean
public boolean asBoolean()Description copied from interface:JsonValueBaseConverts this to a Java boolean.- Specified by:
asBooleanin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a boolean
-
asInt
public int asInt()Description copied from interface:JsonValueBaseConverts this to a Java int.- Specified by:
asIntin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- an int
-
asLong
public long asLong()Description copied from interface:JsonValueBaseConverts this to a Java long.- Specified by:
asLongin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a long
-
asBigInteger
Description copied from interface:JsonValueBaseConverts this to a JavaBigInteger.- Specified by:
asBigIntegerin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a
BigInteger
-
asDouble
public double asDouble()Description copied from interface:JsonValueBaseConverts this to a Java double.- Specified by:
asDoublein interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a double
-
asBigDecimal
Description copied from interface:JsonValueBaseConverts this to a JavaBigDecimal.- Specified by:
asBigDecimalin interfaceJsonValueBase<JakartaJsonValue>- Returns:
- a
BigDecimal
-
asObject
Description copied from interface:JsonValueBaseConverts this to a JSON object wrapper.- Specified by:
asObjectin interfaceJsonValueBase<JakartaJsonValue>- Specified by:
asObjectin interfaceJsonValueCore<JakartaJsonValue>- Returns:
- a JSON object wrapper
-
asArray
Description copied from interface:JsonValueBaseConverts this to a JSON array wrapper.- Specified by:
asArrayin interfaceJsonValueBase<JakartaJsonValue>- Specified by:
asArrayin interfaceJsonValueCore<JakartaJsonValue>- Returns:
- a JSON array wrapper
-
asValue
Description copied from interface:JsonValueBaseConverts this to a JSON value wrapper.- Specified by:
asValuein interfaceJsonValueBase<JakartaJsonValue>- Specified by:
asValuein interfaceJsonValueCore<JakartaJsonValue>- Returns:
- a JSON value wrapper
-
getSource
Description copied from interface:JsonSourceReturns a JSON elementary object.- Specified by:
getSourcein interfaceJsonSource- Returns:
- a JSON elementary object
-
toJson
Description copied from interface:JsonableReturns a JSON string which represents this object. -
hashCode
public int hashCode() -
equals
-
toString
-