@Component
public final class JsonUtilities
extends java.lang.Object
| Constructor and Description |
|---|
JsonUtilities() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Iterator<java.lang.String> |
getFieldNames(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
Get a string iterator for the field names of the last specified child node in the specified
JsonNode.
|
boolean |
getNestedBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
Get the boolean value from the nested child node(s).
|
com.fasterxml.jackson.databind.JsonNode |
getNestedElement(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
Get a nested element from a JsonNode.
|
java.lang.String |
getNestedText(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
Get the text from nested child node(s).
|
java.lang.String[] |
getNestedTexts(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String split,
java.lang.String... childNodes)
Get the array of texts from the nested child node(s) comma-separated text.
|
boolean |
nestedTextContains(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String contains,
java.lang.String... childNodes)
Check whether a child node contains the specified text.
|
boolean |
nestedTextEqualsIgnoreCase(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String equalsIgnoreCase,
java.lang.String... childNodes)
Check whether the text in specified child node(s) is equal to the specified text,
case-insensitive.
|
boolean |
nestedTextIsEmpty(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
Check whether the text in the specified child node(s) is empty.
|
boolean |
nestedTextMatches(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String matches,
java.lang.String... childNodes)
Check whether the text in specified child node(s) matches the specified text.
|
public boolean nestedTextMatches(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String matches,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the text.matches - The text to check for a match.childNodes - The nested nodes in the JsonNode to acquire the text from, in order.true if the texts match.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public boolean nestedTextEqualsIgnoreCase(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String equalsIgnoreCase,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the text.equalsIgnoreCase - The text to check with whether it is equal, case-insensitive.childNodes - The nested nodes in the JsonNode to acquire the text from, in order.true if the texts are equal, case-insensitive.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public boolean nestedTextIsEmpty(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the text.childNodes - The nested nodes in the JsonNode to acquire the text from, in order.true if the text in the requested node is empty.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public boolean getNestedBoolean(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
throws java.lang.NullPointerException,
JsonException
jsonNode - The JsonNode from which to acquire the boolean.childNodes - The nested nodes in the JsonNode to acquire the boolean from, in order.true or false, based on the boolean in the specified child node(s).JsonException - if the specified node(s) contain no boolean or the requested value
is not a parsable boolean value.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public java.lang.String[] getNestedTexts(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String split,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the texts from.split - ThechildNodes - The nested nodes in the JsonNode to acquire the texts from, in order.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public boolean nestedTextContains(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String contains,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the text for checks.contains - The text to check with whether the node contains it.childNodes - The child node(s) from which to acquire the text for contain-checks from, in
order.true if the child node contains the specified text.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public java.lang.String getNestedText(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the text from.childNodes - The child nodes which contain the requested text, in order.java.lang.NullPointerException - if the requested element is not present in the JsonNode.public java.util.Iterator<java.lang.String> getFieldNames(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to get the string iterator.childNodes - The nested nodes from which to get the iterator, in order.java.lang.NullPointerException - if any of the specified child nodes can not be found in the passed
JsonNode.public com.fasterxml.jackson.databind.JsonNode getNestedElement(com.fasterxml.jackson.databind.JsonNode jsonNode,
java.lang.String... childNodes)
throws java.lang.NullPointerException
jsonNode - The JsonNode from which to acquire the nested element.childNodes - The nested elements, in order.java.lang.NullPointerException - if the requested element is not present in the JsonNode.