|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.entity.remotelink.LazyJsonParser
public class LazyJsonParser
Lazy-loading JSON tree parser.
Nested Class Summary | |
---|---|
static class |
LazyJsonParser.ReadOnlyJsonNode
Provides the same functionality that a true JsonNode would, except that
the nodes may not be cast to their original mutable types, thereby protecting the
JSON data against modification. |
Constructor Summary | |
---|---|
LazyJsonParser(String json)
|
Method Summary | |
---|---|
String |
getJson()
Returns the original JSON string. |
String |
getTextAtPath(String... fieldNames)
Descends into the parsed JSON data by field names and extract the text value, if any, that is provided at the specified sub-path. |
LazyJsonParser.ReadOnlyJsonNode |
root()
Returns the root node of the parsed JSON as a LazyJsonParser.ReadOnlyJsonNode . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LazyJsonParser(String json)
Method Detail |
---|
public String getJson()
public LazyJsonParser.ReadOnlyJsonNode root()
LazyJsonParser.ReadOnlyJsonNode
.
LazyJsonParser.ReadOnlyJsonNode
.public String getTextAtPath(String... fieldNames)
{
"a" : {
"b" : 42,
"c" : {
"d" : "x",
"e" : true
}
}
}
Calling getTextAsPath("a", "b", "c", "d")
would return "x"
. However,
any other call would return null
, as it would refer to a path that does not exist
or that contains a value that is not text.
fieldNames
- the list of field names to descend into
null
if that location does not exist
or contains anything other than text
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |