public class JMJson extends Object
| Modifier and Type | Field | Description |
|---|---|---|
static com.fasterxml.jackson.core.type.TypeReference<List<Map<String,Object>>> |
LIST_MAP_TYPE_REFERENCE |
The constant LIST_MAP_TYPE_REFERENCE.
|
static com.fasterxml.jackson.core.type.TypeReference<List<Object>> |
LIST_TYPE_REFERENCE |
The constant LIST_TYPE_REFERENCE.
|
static com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> |
MAP_TYPE_REFERENCE |
The constant MAP_TYPE_REFERENCE.
|
| Constructor | Description |
|---|---|
JMJson() |
| Modifier and Type | Method | Description |
|---|---|---|
static <T> com.fasterxml.jackson.core.type.TypeReference<T> |
getMapOrListTypeReference() |
Gets map or list type reference.
|
static <D> File |
toJsonFile(D dataObject,
File returnJsonFile) |
To json file file.
|
static File |
toJsonFile(String jsonString,
File returnJsonFile) |
To json file file.
|
static <D> String |
toJsonString(D dataObject) |
To json string string.
|
static String |
toJsonString(File jsonFile) |
To json string string.
|
static List<Object> |
toList(String jsonListString) |
To list list.
|
static Map<String,Object> |
toMap(String jsonObjectString) |
To map map.
|
static List<Map<String,Object>> |
toMapList(String jsonMapListString) |
To map list list.
|
static String |
toPrettyJsonString(Object object) |
To pretty json string string.
|
static String |
toPrettyString(String jsonString) |
To pretty string string.
|
static <T1,T2> T2 |
transform(T1 object,
com.fasterxml.jackson.core.type.TypeReference<T2> typeReference) |
Transform t 2.
|
static <T1,T2> T2 |
transform(T1 object,
Class<T2> typeClass) |
Transform t 2.
|
static <T> Map<String,Object> |
transformToMap(T object) |
Transform to map map.
|
static <T> T |
withBytes(byte[] bytes,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With bytes t.
|
static <T> T |
withBytes(byte[] bytes,
Class<T> c) |
With bytes t.
|
static <T> T |
withClasspathOrFilePath(String resourceClasspathOrFilePath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With classpath or file path t.
|
static <T> T |
withFilePathOrClasspath(String resourceFilePathOrClasspath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With file path or classpath t.
|
static <T> T |
withJsonFile(File jsonFile,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With json file t.
|
static <T> T |
withJsonFile(File jsonFile,
Class<T> c) |
With json file t.
|
static <T> T |
withJsonInputStream(InputStream inputStream,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With json input stream t.
|
static <T> T |
withJsonInputStream(InputStream inputStream,
Class<T> c) |
With json input stream t.
|
static <T> T |
withJsonResource(String resourceClasspath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With json resource t.
|
static <T> T |
withJsonResource(String resourceClasspath,
Class<T> c) |
With json resource t.
|
static <T> T |
withJsonString(String jsonString,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With json string t.
|
static <T> T |
withJsonString(String jsonString,
Class<T> c) |
With json string t.
|
static <T> T |
withRestOrClasspathOrFilePath(String resourceRestUrlOrClasspathOrFilePath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With rest or classpath or file path t.
|
static <T> T |
withRestOrFilePathOrClasspath(String resourceRestOrFilePathOrClasspath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
With rest or file path or classpath t.
|
public static final com.fasterxml.jackson.core.type.TypeReference<Map<String,Object>> MAP_TYPE_REFERENCE
public static final com.fasterxml.jackson.core.type.TypeReference<List<Object>> LIST_TYPE_REFERENCE
public static <T> com.fasterxml.jackson.core.type.TypeReference<T> getMapOrListTypeReference()
T - the type parameterpublic static <D> String toJsonString(D dataObject)
D - the type parameterdataObject - the data objectpublic static String toJsonString(File jsonFile)
jsonFile - the json filepublic static File toJsonFile(String jsonString, File returnJsonFile)
jsonString - the json stringreturnJsonFile - the return json filepublic static <D> File toJsonFile(D dataObject, File returnJsonFile)
D - the type parameterdataObject - the data objectreturnJsonFile - the return json filepublic static <T> T withBytes(byte[] bytes,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterbytes - the bytestypeReference - the type referencepublic static <T> T withBytes(byte[] bytes,
Class<T> c)
T - the type parameterbytes - the bytesc - the cpublic static <T> T withJsonString(String jsonString, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterjsonString - the json stringtypeReference - the type referencepublic static Map<String,Object> toMap(String jsonObjectString)
jsonObjectString - the json object stringpublic static List<Object> toList(String jsonListString)
jsonListString - the json list stringpublic static List<Map<String,Object>> toMapList(String jsonMapListString)
jsonMapListString - the json map list stringpublic static <T> T withJsonString(String jsonString, Class<T> c)
T - the type parameterjsonString - the json stringc - the cpublic static <T> T withJsonFile(File jsonFile, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterjsonFile - the json filetypeReference - the type referencepublic static <T> T withJsonFile(File jsonFile, Class<T> c)
T - the type parameterjsonFile - the json filec - the cpublic static <T> T withJsonInputStream(InputStream inputStream, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterinputStream - the input streamtypeReference - the type referencepublic static <T> T withJsonInputStream(InputStream inputStream, Class<T> c)
T - the type parameterinputStream - the input streamc - the cpublic static <T> T withJsonResource(String resourceClasspath, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterresourceClasspath - the resource classpathtypeReference - the type referencepublic static <T> T withJsonResource(String resourceClasspath, Class<T> c)
T - the type parameterresourceClasspath - the resource classpathc - the cpublic static <T> T withRestOrClasspathOrFilePath(String resourceRestUrlOrClasspathOrFilePath, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterresourceRestUrlOrClasspathOrFilePath - the resource rest url or classpath or file pathtypeReference - the type referencepublic static <T> T withRestOrFilePathOrClasspath(String resourceRestOrFilePathOrClasspath, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterresourceRestOrFilePathOrClasspath - the resource rest or file path or classpathtypeReference - the type referencepublic static <T> T withClasspathOrFilePath(String resourceClasspathOrFilePath, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterresourceClasspathOrFilePath - the resource classpath or file pathtypeReference - the type referencepublic static <T> T withFilePathOrClasspath(String resourceFilePathOrClasspath, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterresourceFilePathOrClasspath - the resource file path or classpathtypeReference - the type referencepublic static <T> Map<String,Object> transformToMap(T object)
T - the type parameterobject - the objectpublic static <T1,T2> T2 transform(T1 object,
com.fasterxml.jackson.core.type.TypeReference<T2> typeReference)
T1 - the type parameterT2 - the type parameterobject - the objecttypeReference - the type referencepublic static <T1,T2> T2 transform(T1 object,
Class<T2> typeClass)
T1 - the type parameterT2 - the type parameterobject - the objecttypeClass - the type classpublic static String toPrettyString(String jsonString)
jsonString - the json stringCopyright © 2018. All rights reserved.