
public class JsonHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
mapper
JSON parser
|
static com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> |
typeReferenceMapStringObject |
| Modifier | Constructor and Description |
|---|---|
protected |
JsonHandler() |
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.node.ArrayNode |
createArrayNode() |
static com.fasterxml.jackson.databind.node.ObjectNode |
createObjectNode() |
static boolean |
exist(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?>... field) |
static boolean |
exist(com.fasterxml.jackson.databind.node.ObjectNode node,
String... field) |
static com.fasterxml.jackson.databind.node.ObjectNode |
getFromFile(File file) |
static Object |
getFromFile(File file,
Class<?> clasz) |
static com.fasterxml.jackson.databind.node.ObjectNode |
getFromString(String value)
Parses a string representation of a JSON object and returns an
ObjectNode,
swallowing any processing
exception.
|
static <T> T |
getFromString(String value,
Class<T> clasz) |
static com.fasterxml.jackson.databind.node.ObjectNode |
getFromStringExc(String value)
Parses a string representation of a JSON object and returns an
ObjectNode.
|
static Map<String,Object> |
getMapFromString(String value) |
static String |
getString(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field) |
static String |
getString(com.fasterxml.jackson.databind.node.ObjectNode node,
String field) |
static Boolean |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
boolean defValue) |
static byte[] |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
byte[] defValue) |
static Double |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
double defValue) |
static Integer |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
int defValue) |
static Long |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
long defValue) |
static String |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
String defValue) |
static Boolean |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
boolean defValue) |
static byte[] |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
byte[] defValue) |
static Double |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
double defValue) |
static Integer |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
int defValue) |
static Long |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
long defValue) |
static String |
getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
String defValue) |
static String |
prettyPrint(Object object) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
boolean value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
byte[] value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
double value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
int value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
long value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
String value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
boolean value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
byte[] value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
double value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
int value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
long value) |
static void |
setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
String value) |
static String |
unEscape(String source)
Unespace source string before analyzing it as Json
|
static boolean |
writeAsFile(Object object,
File file) |
static String |
writeAsString(Object object) |
static String |
writeAsStringEscaped(Object object) |
public static final com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> typeReferenceMapStringObject
public static final com.fasterxml.jackson.databind.ObjectMapper mapper
public static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()
public static com.fasterxml.jackson.databind.node.ArrayNode createArrayNode()
public static com.fasterxml.jackson.databind.node.ObjectNode getFromStringExc(String value) throws com.fasterxml.jackson.core.JsonProcessingException
value - com.fasterxml.jackson.core.JsonProcessingExceptionpublic static com.fasterxml.jackson.databind.node.ObjectNode getFromString(String value)
value - public static com.fasterxml.jackson.databind.node.ObjectNode getFromFile(File file)
file - public static <T> T getFromString(String value, Class<T> clasz)
value - clasz - public static Object getFromFile(File file, Class<?> clasz)
file - clasz - public static String writeAsString(Object object)
object - public static String writeAsStringEscaped(Object object)
object - public static String unEscape(String source)
source - public static boolean writeAsFile(Object object, File file)
object - file - public static String prettyPrint(Object object)
object - public static String getString(com.fasterxml.jackson.databind.node.ObjectNode node, String field)
node - field - public static String getString(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field)
node - field - public static String getValue(com.fasterxml.jackson.databind.node.ObjectNode node, String field, String defValue)
node - field - defValue - public static Boolean getValue(com.fasterxml.jackson.databind.node.ObjectNode node, String field, boolean defValue)
node - field - defValue - public static Double getValue(com.fasterxml.jackson.databind.node.ObjectNode node, String field, double defValue)
node - field - defValue - public static Long getValue(com.fasterxml.jackson.databind.node.ObjectNode node, String field, long defValue)
node - field - defValue - public static Integer getValue(com.fasterxml.jackson.databind.node.ObjectNode node, String field, int defValue)
node - field - defValue - public static byte[] getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
byte[] defValue)
node - field - defValue - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
boolean value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
double value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
int value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
long value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
String value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
String field,
byte[] value)
node - field - value - public static boolean exist(com.fasterxml.jackson.databind.node.ObjectNode node,
String... field)
node - field - public static String getValue(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field, String defValue)
node - field - defValue - public static Boolean getValue(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field, boolean defValue)
node - field - defValue - public static Double getValue(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field, double defValue)
node - field - defValue - public static Long getValue(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field, long defValue)
node - field - defValue - public static Integer getValue(com.fasterxml.jackson.databind.node.ObjectNode node, Enum<?> field, int defValue)
node - field - defValue - public static byte[] getValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
byte[] defValue)
node - field - defValue - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
boolean value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
double value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
int value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
long value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
String value)
node - field - value - public static void setValue(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?> field,
byte[] value)
node - field - value - public static boolean exist(com.fasterxml.jackson.databind.node.ObjectNode node,
Enum<?>... field)
node - field - Copyright © 2009–2022 Waarp. All rights reserved.