public final class JsonUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.node.ArrayNode |
arrayNode() |
static BigDecimal |
bigDecimalProperty(com.fasterxml.jackson.databind.JsonNode node,
String propertyName)
Extract a BigDecimal property from the given json tree.
|
static void |
bigDecimalProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
BigDecimal propertyValue)
Sets the value of a property for a given json node.
|
static Optional<Boolean> |
booleanProperty(com.fasterxml.jackson.databind.JsonNode node,
String propertyName)
Extract a boolean property from the given json tree.
|
static void |
booleanProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
Boolean propertyValue)
Sets the value of a property for a given json node.
|
static <E extends Enum<E>> |
enumProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
E propertyValue)
Sets the value of a property for a given json node.
|
static Integer |
intProperty(com.fasterxml.jackson.databind.JsonNode node,
String propertyName)
Extract a integer property from the given json tree.
|
static void |
intProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
Integer propertyValue)
Sets the value of a property for a given json node.
|
static com.fasterxml.jackson.databind.node.ObjectNode |
objectNode() |
static Object |
parseValue(String value)
Parses an extension value.
|
static Object |
readObject(com.fasterxml.jackson.databind.JsonNode node)
Reads the node as a Java object.This is typically expected to be a literal of
some sort, as in the case of default values and examples.
|
static Optional<List<Object>> |
readObjectArray(com.fasterxml.jackson.databind.JsonNode node)
Reads an object array.
|
static Optional<List<String>> |
readStringArray(com.fasterxml.jackson.databind.JsonNode node)
Reads a string array.
|
static Optional<Map<String,String>> |
readStringMap(com.fasterxml.jackson.databind.JsonNode node)
Reads a map of strings.
|
static String |
stringProperty(com.fasterxml.jackson.databind.JsonNode node,
String propertyName)
Extract a string property from the given json tree.
|
static void |
stringProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
String propertyValue)
Sets the value of a property for a given json node.
|
public static com.fasterxml.jackson.databind.node.ObjectNode objectNode()
public static com.fasterxml.jackson.databind.node.ArrayNode arrayNode()
public static String stringProperty(com.fasterxml.jackson.databind.JsonNode node, String propertyName)
node - JsonNodepropertyName - Property to extractpublic static void stringProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
String propertyValue)
node - ObjectNodepropertyName - Property to be setpropertyValue - Value to be setpublic static <E extends Enum<E>> void enumProperty(com.fasterxml.jackson.databind.node.ObjectNode node, String propertyName, E propertyValue)
E - Type of the property valuenode - ObjectNodepropertyName - Property to be setpropertyValue - Value to be setpublic static Optional<Boolean> booleanProperty(com.fasterxml.jackson.databind.JsonNode node, String propertyName)
node - JsonNodepropertyName - Property to extractpublic static void booleanProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
Boolean propertyValue)
node - ObjectNodepropertyName - Property to be setpropertyValue - Boolean value to be setpublic static Integer intProperty(com.fasterxml.jackson.databind.JsonNode node, String propertyName)
node - JsonNodepropertyName - Property to extractpublic static void intProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
Integer propertyValue)
node - ObjectNodepropertyName - Property to be setpropertyValue - Integer value to be setpublic static BigDecimal bigDecimalProperty(com.fasterxml.jackson.databind.JsonNode node, String propertyName)
node - JsonNodepropertyName - Property to extractpublic static void bigDecimalProperty(com.fasterxml.jackson.databind.node.ObjectNode node,
String propertyName,
BigDecimal propertyValue)
node - ObjectNodepropertyName - Property to be setpropertyValue - BigDecimal value to be setpublic static Object readObject(com.fasterxml.jackson.databind.JsonNode node)
node - the json nodepublic static Object parseValue(String value)
value - the value to parsepublic static Optional<List<String>> readStringArray(com.fasterxml.jackson.databind.JsonNode node)
node - the json nodepublic static Optional<List<Object>> readObjectArray(com.fasterxml.jackson.databind.JsonNode node)
node - the json nodeCopyright © 2018–2021. All rights reserved.