public class JMJson extends Object
| Modifier and Type | Field and 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 and Description |
|---|
JMJson() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Map<String,Object> |
convertMap(T pojoBean)
Convert map map.
|
static <T> com.fasterxml.jackson.core.type.TypeReference<T> |
getTypeReference()
Gets 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> File |
toJsonFileOrNull(D dataObject,
File returnJsonFile)
To json file or null file.
|
static File |
toJsonFileOrNull(String jsonString,
File returnJsonFile)
To json file or null file.
|
static <D> String |
toJsonString(D dataObject)
To json string string.
|
static String |
toJsonString(File jsonFile)
To json string string.
|
static <D> String |
toJsonStringOrNull(D dataObject)
To json string or null 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 <T1,T2> T2 |
transform(T1 object,
com.fasterxml.jackson.core.type.TypeReference<T2> transformTypeReference)
Transform t 2.
|
static <T> T |
withBytes(byte[] bytes,
Class<T> c)
With bytes t.
|
static <T> T |
withBytes(byte[] bytes,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With bytes t.
|
static <T> T |
withBytesOrNull(byte[] bytes,
Class<T> c)
With bytes or null t.
|
static <T> T |
withBytesOrNull(byte[] bytes,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With bytes or null 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,
Class<T> c)
With json file t.
|
static <T> T |
withJsonFile(File jsonFile,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json file t.
|
static <T> T |
withJsonFileOrNull(File jsonFile,
Class<T> c)
With json file or null t.
|
static <T> T |
withJsonFileOrNull(File jsonFile,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json file or null t.
|
static <T> T |
withJsonInputStream(InputStream inputStream,
Class<T> c)
With json input stream t.
|
static <T> T |
withJsonInputStream(InputStream inputStream,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json input stream t.
|
static <T> T |
withJsonInputStreamOrNull(InputStream inputStream,
Class<T> c)
With json input stream or null t.
|
static <T> T |
withJsonInputStreamOrNull(InputStream inputStream,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json input stream or null t.
|
static <T> T |
withJsonResource(String resourceClasspath,
Class<T> c)
With json resource t.
|
static <T> T |
withJsonResource(String resourceClasspath,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json resource t.
|
static <T> T |
withJsonString(String jsonString,
Class<T> c)
With json string t.
|
static <T> T |
withJsonString(String jsonString,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json string t.
|
static <T> T |
withJsonStringOrNull(String jsonString,
Class<T> c)
With json string or null t.
|
static <T> T |
withJsonStringOrNull(String jsonString,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
With json string or null 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 <D> String toJsonString(D dataObject)
D - the type parameterdataObject - the data objectpublic static <D> String toJsonStringOrNull(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 File toJsonFileOrNull(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 <D> File toJsonFileOrNull(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 withBytesOrNull(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 withBytesOrNull(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 withJsonStringOrNull(String jsonString, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
T - the type parameterjsonString - the json stringtypeReference - the type referencepublic static <T> T withJsonString(String jsonString, Class<T> c)
T - the type parameterjsonString - the json stringc - the cpublic static <T> T withJsonStringOrNull(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 withJsonFileOrNull(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 withJsonFileOrNull(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 withJsonInputStreamOrNull(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 withJsonInputStreamOrNull(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> convertMap(T pojoBean)
T - the type parameterpojoBean - the pojo beanpublic static <T1,T2> T2 transform(T1 object,
com.fasterxml.jackson.core.type.TypeReference<T2> transformTypeReference)
T1 - the type parameterT2 - the type parameterobject - the objecttransformTypeReference - the transform type referencepublic static <T> com.fasterxml.jackson.core.type.TypeReference<T> getTypeReference()
T - the type parameterCopyright © 2018. All rights reserved.