public class JsonObjectImpl extends JsonValueImpl implements JsonObject, JsonGroup, JsonMember
| Constructor and Description |
|---|
JsonObjectImpl() |
| Modifier and Type | Method and Description |
|---|---|
JsonObject |
add(String name,
JsonValue value)
Adds attribute ti this json object at last position.
|
JsonObject |
add(String name,
JsonValue value,
int index)
Adds attribute ti this json object at specified position.
|
List<JsonValue> |
all(String name)
Values of all attributes with specidied name
|
JsonAttribute |
attr(int index)
Reads n'th attribute of this json object
|
JsonAttribute |
attr(String name)
Reads first attribute of this json object with specified name
|
List<JsonAttributeImpl> |
attrs() |
List<JsonAttribute> |
attrs(String name)
Reads all attributes of this json object with specified name
|
void |
clear()
Clears all attributes from this json object.
|
void |
findAll(PathMatcher matcher,
List<JsonValue> values,
List<String> path) |
JsonValue |
findFirst(PathMatcher matcher,
List<String> path) |
JsonValue |
first()
Returns value of first attribute.
|
JsonValue |
first(String name)
Value of first attribute with specidied name
|
int |
firstIndex(String name)
Index of first attribute with specidied name
|
JsonGroup |
group() |
boolean |
isEmpty()
Checks if object has any attribute.
|
JsonValue |
last()
Returns value of last attribute.
|
int |
memberIndex(JsonMember m) |
void |
remove()
Removes this instance from parent object.
|
void |
remove(JsonAttribute attr) |
JsonObject |
removeAll(String name)
Removes all values with specified name.
|
JsonAttribute |
removeAttr(int index)
Removes n'th attribute from this json object.
|
void |
setGroup(JsonGroup group) |
int |
size()
Size of json object.
|
void |
toCompactString(StringBuilder sb) |
List<JsonAttribute> |
toList()
Converts attributes to regular list.
|
void |
toPrettyString(StringBuilder sb,
String prefix,
String indent) |
asArray, asBoolLiteral, asExpLiteral, asFracLiteral, asIntLiteral, asLiteral, asNullLiteral, asObject, asStringLiteral, findAll, findAllLiterals, findFirst, findFirstLiteral, isArray, isBoolLiteral, isExpLiteral, isFracLiteral, isIntLiteral, isLiteral, isNullLiteral, isObject, isStringLiteral, parent, parentIndex, path, toCompactString, toPrettyStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasArray, asBoolLiteral, asExpLiteral, asFracLiteral, asIntLiteral, asLiteral, asNullLiteral, asObject, asStringLiteral, findAll, findAllLiterals, findFirst, findFirstLiteral, isArray, isBoolLiteral, isExpLiteral, isFracLiteral, isIntLiteral, isLiteral, isNullLiteral, isObject, isStringLiteral, parent, parentIndex, path, toCompactString, toPrettyStringpublic List<JsonAttributeImpl> attrs()
public JsonGroup group()
group in interface JsonMemberpublic void setGroup(JsonGroup group)
setGroup in interface JsonMemberpublic void toCompactString(StringBuilder sb)
toCompactString in class JsonValueImplpublic void toPrettyString(StringBuilder sb, String prefix, String indent)
toPrettyString in class JsonValueImplpublic boolean isEmpty()
JsonObjectisEmpty in interface JsonObjectpublic int size()
JsonObjectsize in interface JsonObjectpublic void clear()
JsonObjectclear in interface JsonObjectpublic JsonAttribute attr(int index)
JsonObjectattr in interface JsonObjectindex - of the attribute which is read (first attribute has index=0)public JsonValue first()
JsonObjectfirst in interface JsonObjectpublic JsonValue last()
JsonObjectlast in interface JsonObjectpublic JsonAttribute removeAttr(int index)
JsonObjectremoveAttr in interface JsonObjectindex - position of attribute which should be removedpublic List<JsonAttribute> toList()
JsonObjecttoList in interface JsonObjectpublic JsonObject add(String name, JsonValue value)
JsonObjectadd in interface JsonObjectname - name of the attributevalue - value of the attributepublic JsonObject add(String name, JsonValue value, int index)
JsonObjectadd in interface JsonObjectname - name of the attributevalue - value of the attributeindex - position of the attributepublic int firstIndex(String name)
JsonObjectfirstIndex in interface JsonObjectname - name of the attribute which should be foundpublic JsonValue first(String name)
JsonObjectfirst in interface JsonObjectname - name of the attribute which should be foundpublic List<JsonValue> all(String name)
JsonObjectall in interface JsonObjectname - name of the attributes which should be foundpublic JsonObject removeAll(String name)
JsonObjectremoveAll in interface JsonObjectname - of attributes to be removedpublic int memberIndex(JsonMember m)
memberIndex in interface JsonGrouppublic JsonValue findFirst(PathMatcher matcher, List<String> path)
findFirst in class JsonValueImplpublic void findAll(PathMatcher matcher, List<JsonValue> values, List<String> path)
findAll in class JsonValueImplpublic JsonAttribute attr(String name)
JsonObjectattr in interface JsonObjectname - of the attribute which is read (first attribute with the name will be returned)public List<JsonAttribute> attrs(String name)
JsonObjectattrs in interface JsonObjectname - of the attributes which is read (all attributes with the name will be returned)public void remove(JsonAttribute attr)
Copyright © 2018. All rights reserved.