Class JSONValueObjectMutable
- java.lang.Object
 - 
- com.github.tnakamot.json.value.JSONValue
 - 
- com.github.tnakamot.json.value.JSONValueStructured
 - 
- com.github.tnakamot.json.value.JSONValueObject
 - 
- com.github.tnakamot.json.value.JSONValueObjectMutable
 
 
 
 
 
- 
- All Implemented Interfaces:
 Map<JSONValueString,JSONValue>
public class JSONValueObjectMutable extends JSONValueObject
Represents one JSON 'object' value (mutable).This implementation retains the order.
- See Also:
 JSONValueObjectImmutable
 
- 
- 
Constructor Summary
Constructors Constructor Description JSONValueObjectMutable()Create an instance of a Java representation of an empty JSON 'object' value. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object o)booleancontainsKey(String s)Check if this JSON object has a value which has the given name.booleancontainsValue(Object o)@NotNull Set<Map.Entry<JSONValueString,JSONValue>>entrySet()JSONValueget(JSONValueString name)Returns the JSON value of the given name.JSONValueget(Object o)JSONValueget(String name)Returns the JSON value which has the given name.booleanisEmpty()@NotNull Set<JSONValueString>keySet()JSONValueput(JSONValueString jsonValueString, JSONValue jsonValue)voidputAll(@NotNull Map<? extends JSONValueString,? extends JSONValue> map)JSONValueremove(Object o)intsize()JSONValueObjectImmutabletoImmutable()Return the copy of this JSON object as an immutable Java object.JSONValueObjectImmutabletoImmutable(@Nullable JSONToken begin, @Nullable JSONToken end)Return the copy of this JSON object as an immutable Java object with token information.@NotNull StringtoTokenString()Convert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network.@NotNull StringtoTokenString(String newline, String indent)Convert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network.@NotNull Collection<JSONValue>values()- 
Methods inherited from class com.github.tnakamot.json.value.JSONValueObject
equals, getArray, getBoolean, getDouble, getLong, getObject, getString, hashCode, put, put, put, put, put, remove 
- 
Methods inherited from class com.github.tnakamot.json.value.JSONValueStructured
begin, end 
- 
Methods inherited from class com.github.tnakamot.json.value.JSONValue
toTokenBytes, toTokenBytes, type 
- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll 
 - 
 
 - 
 
- 
- 
Method Detail
- 
get
public JSONValue get(JSONValueString name)
Returns the JSON value of the given name.If a value of the given name does not exist, this method returns null. Do not confuse it with a JSON 'null' value. If there is a JSON 'null' value of the given name, this method returns an instance of
JSONValueNullinstead.- Specified by:
 getin classJSONValueObject- Parameters:
 name- a JSON string value which represents a name- Returns:
 - a JSON value of the given name
 
 
- 
get
public JSONValue get(String name)
Returns the JSON value which has the given name.- Specified by:
 getin classJSONValueObject- Parameters:
 name- name- Returns:
 - a JSON value of the given name
 - See Also:
 get(JSONValueString)
 
- 
size
public int size()
- Specified by:
 sizein interfaceMap<JSONValueString,JSONValue>- Specified by:
 sizein classJSONValueObject
 
- 
isEmpty
public boolean isEmpty()
- Specified by:
 isEmptyin interfaceMap<JSONValueString,JSONValue>- Specified by:
 isEmptyin classJSONValueObject
 
- 
containsKey
public boolean containsKey(Object o)
- Specified by:
 containsKeyin interfaceMap<JSONValueString,JSONValue>- Specified by:
 containsKeyin classJSONValueObject
 
- 
containsKey
public boolean containsKey(String s)
Check if this JSON object has a value which has the given name.- Specified by:
 containsKeyin classJSONValueObject- Parameters:
 s- name- Returns:
 - true if a value with the given name exists
 - See Also:
 JSONValueObject.containsKey(Object)
 
- 
containsValue
public boolean containsValue(Object o)
- Specified by:
 containsValuein interfaceMap<JSONValueString,JSONValue>- Specified by:
 containsValuein classJSONValueObject
 
- 
get
public JSONValue get(Object o)
- Specified by:
 getin interfaceMap<JSONValueString,JSONValue>- Specified by:
 getin classJSONValueObject
 
- 
put
public JSONValue put(JSONValueString jsonValueString, JSONValue jsonValue)
- Specified by:
 putin interfaceMap<JSONValueString,JSONValue>- Specified by:
 putin classJSONValueObject
 
- 
remove
public JSONValue remove(Object o)
- Specified by:
 removein interfaceMap<JSONValueString,JSONValue>- Specified by:
 removein classJSONValueObject
 
- 
putAll
public void putAll(@NotNull @NotNull Map<? extends JSONValueString,? extends JSONValue> map)- Specified by:
 putAllin interfaceMap<JSONValueString,JSONValue>- Specified by:
 putAllin classJSONValueObject
 
- 
clear
public void clear()
- Specified by:
 clearin interfaceMap<JSONValueString,JSONValue>- Specified by:
 clearin classJSONValueObject
 
- 
keySet
@NotNull public @NotNull Set<JSONValueString> keySet()
- Specified by:
 keySetin interfaceMap<JSONValueString,JSONValue>- Specified by:
 keySetin classJSONValueObject
 
- 
values
@NotNull public @NotNull Collection<JSONValue> values()
- Specified by:
 valuesin interfaceMap<JSONValueString,JSONValue>- Specified by:
 valuesin classJSONValueObject
 
- 
entrySet
@NotNull public @NotNull Set<Map.Entry<JSONValueString,JSONValue>> entrySet()
- Specified by:
 entrySetin interfaceMap<JSONValueString,JSONValue>- Specified by:
 entrySetin classJSONValueObject
 
- 
toImmutable
public JSONValueObjectImmutable toImmutable()
Return the copy of this JSON object as an immutable Java object.All inner JSON objects and JSON arrays are also turned to be immutable.
- Returns:
 - an immutable version of the same JSON object.
 
 
- 
toImmutable
public JSONValueObjectImmutable toImmutable(@Nullable @Nullable JSONToken begin, @Nullable @Nullable JSONToken end)
Return the copy of this JSON object as an immutable Java object with token information.All inner JSON objects and JSON arrays are also turned to be immutable.
- Parameters:
 begin- the beginning token of this JSON object. Null if this JSON object does not originate from an exsiting JSON text.end- the end token of this JSON object. Null if this JSON object does not originate from an exsiting JSON text.- Returns:
 - an immutable version of the same JSON object.
 
 
- 
toTokenString
@NotNull public @NotNull String toTokenString()
Description copied from class:JSONValueConvert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network. The output text is optimized for machine, so no indent or new lines will be inserted.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
 toTokenStringin classJSONValue- Returns:
 - a string representation of this JSON value
 
 
- 
toTokenString
@NotNull public @NotNull String toTokenString(String newline, String indent)
Description copied from class:JSONValueConvert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network. The output text is optimized for human. Indents and new line characters are inserted accordingly.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
 toTokenStringin classJSONValue- Parameters:
 newline- line separator; "\r", "\n" or "\r\n"indent- indent string. Must consist of " " and "\t".- Returns:
 - a string representation of this JSON value
 
 
 - 
 
 -