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
FieldsModifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.databind.ObjectMapperstatic final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.node.ObjectNodestatic com.fasterxml.jackson.databind.node.ObjectNodecreateObjectNode(Object pojo) Creates anObjectNodebased on the givenpojo, copying all its properties to the resultingObjectNode.static <T> Tstatic <T> TreadValue(InputStream bytes, com.fasterxml.jackson.core.type.TypeReference<T> type) static <T> TreadValue(InputStream bytes, Class<T> type) static <T> Tstatic <T> Tstatic byte[]writeValueAsBytes(Object obj) static com.fasterxml.jackson.databind.JsonNodewriteValueAsNode(Object obj) static Stringstatic StringwriteValueAsString(Object obj) static voidwriteValuePrettyToStream(OutputStream os, Object obj) static voidwriteValueToStream(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
-
-
Constructor Details
-
JsonSerialization
public JsonSerialization()
-
-
Method Details
-
writeValueToStream
- Throws:
IOException
-
writeValuePrettyToStream
- Throws:
IOException
-
writeValueAsPrettyString
- Throws:
IOException
-
writeValueAsString
- Throws:
IOException
-
writeValueAsBytes
- Throws:
IOException
-
writeValueAsNode
-
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
-
createObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode(Object pojo) throws IOException Creates anObjectNodebased 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
ObjectNodewith all the properties from the given pojo - Throws:
IOException- if the resulting aObjectNodecan not be created
-
createObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()
-