Package io.jans.configapi.core.util
Class Jackson
java.lang.Object
io.jans.configapi.core.util.Jackson
- Author:
- Yuriy Zabrovarnyy
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TapplyJsonPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) static <T> TapplyPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) static <T> TapplyPatch(String patchAsString, T obj) static Stringstatic com.fasterxml.jackson.databind.JsonNodeasJsonNode(String objAsString) static StringasPrettyJson(Object obj) static org.json.JSONObjectstatic com.fasterxml.jackson.databind.ObjectMapperstatic org.json.JSONObjectcreateJSONObject(Map<String, Object> map) static StringgetElement(String jsonString, String fieldName) static com.github.fge.jsonpatch.JsonPatchgetJsonPatch(String patchAsString) static <T> StringgetJsonString(T obj) static <T> Tstatic booleanisFieldPresent(String patchAsString, String fieldName) static booleanisValidJson(Object obj) static booleanisValidJson(String json) static <T> Tread(InputStream inputStream, T obj) static <T> List<T>static <T> List<T>static <T> List<T>readListValue(String content, Class<T> clazz) static <T> TreadStringValue(String content, Class<T> clazz)
-
Method Details
-
asJsonNode
public static com.fasterxml.jackson.databind.JsonNode asJsonNode(String objAsString) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getElement
public static String getElement(String jsonString, String fieldName) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
applyPatch
public static <T> T applyPatch(String patchAsString, T obj) throws com.github.fge.jsonpatch.JsonPatchException, IOException - Throws:
com.github.fge.jsonpatch.JsonPatchExceptionIOException
-
isFieldPresent
-
getJsonPatch
public static com.github.fge.jsonpatch.JsonPatch getJsonPatch(String patchAsString) throws com.github.fge.jsonpatch.JsonPatchException, IOException - Throws:
com.github.fge.jsonpatch.JsonPatchExceptionIOException
-
applyJsonPatch
public static <T> T applyJsonPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) throws com.github.fge.jsonpatch.JsonPatchException, IOException - Throws:
com.github.fge.jsonpatch.JsonPatchExceptionIOException
-
applyPatch
public static <T> T applyPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) throws com.github.fge.jsonpatch.JsonPatchException, com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.github.fge.jsonpatch.JsonPatchExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
read
- Throws:
IOException
-
getObject
- Throws:
IOException
-
createJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper() -
getJsonString
- Throws:
IOException
-
asJson
- Throws:
IOException
-
asPrettyJson
- Throws:
IOException
-
readStringValue
public static <T> T readStringValue(String content, Class<T> clazz) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
readListValue
public static <T> List<T> readListValue(String content, Class<T> clazz) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
readList
public static <T> List<T> readList(String str, Class<T> type) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
readList
public static <T> List<T> readList(String str, Class<? extends List> type, Class<T> elementType) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
createJSONObject
public static org.json.JSONObject createJSONObject(Map<String, Object> map) throws org.json.JSONException- Throws:
org.json.JSONException
-
isValidJson
-
isValidJson
-
convertObjectToJsonObject
public static org.json.JSONObject convertObjectToJsonObject(Object obj) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-