Package org.keycloak.util
Class JsonSerialization
java.lang.Object
org.keycloak.util.JsonSerialization
Utility class to handle simple JSON serializable for Keycloak.
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.databind.ObjectMapper
static final com.fasterxml.jackson.databind.ObjectMapper
static final com.fasterxml.jackson.databind.ObjectMapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.node.ObjectNode
static com.fasterxml.jackson.databind.node.ObjectNode
createObjectNode
(Object pojo) Creates anObjectNode
based on the givenpojo
, copying all its properties to the resultingObjectNode
.static <T> T
static <T> T
readValue
(InputStream bytes, com.fasterxml.jackson.core.type.TypeReference<T> type) static <T> T
readValue
(InputStream bytes, Class<T> type) static <T> T
readValue
(InputStream bytes, Class<T> type, boolean replaceSystemProperties) static <T> T
static <T> T
static byte[]
writeValueAsBytes
(Object obj) static String
static String
writeValueAsString
(Object obj) static void
writeValuePrettyToStream
(OutputStream os, Object obj) static void
writeValueToStream
(OutputStream os, Object obj)
-
Field Details
-
mapper
public static final com.fasterxml.jackson.databind.ObjectMapper mapper -
prettyMapper
public static final com.fasterxml.jackson.databind.ObjectMapper prettyMapper -
sysPropertiesAwareMapper
public static final com.fasterxml.jackson.databind.ObjectMapper sysPropertiesAwareMapper
-
-
Constructor Details
-
JsonSerialization
public JsonSerialization()
-
-
Method Details
-
writeValueToStream
- Throws:
IOException
-
writeValuePrettyToStream
- Throws:
IOException
-
writeValueAsPrettyString
- Throws:
IOException
-
writeValueAsString
- Throws:
IOException
-
writeValueAsBytes
- Throws:
IOException
-
readValue
- Throws:
IOException
-
readValue
- Throws:
IOException
-
readValue
- Throws:
IOException
-
readValue
public static <T> T readValue(String string, com.fasterxml.jackson.core.type.TypeReference<T> type) throws IOException - Throws:
IOException
-
readValue
public static <T> T readValue(InputStream bytes, com.fasterxml.jackson.core.type.TypeReference<T> type) throws IOException - Throws:
IOException
-
readValue
public static <T> T readValue(InputStream bytes, Class<T> type, boolean replaceSystemProperties) throws IOException - Throws:
IOException
-
createObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode(Object pojo) throws IOException Creates anObjectNode
based on the givenpojo
, copying all its properties to the resultingObjectNode
.- Parameters:
pojo
- a pojo which properties will be populates into the resulting aObjectNode
- Returns:
- a
ObjectNode
with all the properties from the given pojo - Throws:
IOException
- if the resulting aObjectNode
can not be created
-
createObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()
-