Package org.pac4j.core.util.serializer
Class JsonSerializer
- java.lang.Object
-
- org.pac4j.core.util.serializer.JsonSerializer
-
- All Implemented Interfaces:
Serializer
public class JsonSerializer extends Object implements Serializer
A JSON serializer.- Since:
- 3.9.0
- Author:
- Jerome LELEU
-
-
Constructor Summary
Constructors Constructor Description JsonSerializer(Class<? extends Object> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
decode(String encoded)
Decode a string into an object.String
encode(Object obj)
Encode an object into a string.com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
void
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
-
Method Detail
-
encode
public String encode(Object obj)
Description copied from interface:Serializer
Encode an object into a string.- Specified by:
encode
in interfaceSerializer
- Parameters:
obj
- the object to encode- Returns:
- the encoded string
-
decode
public Object decode(String encoded)
Description copied from interface:Serializer
Decode a string into an object.- Specified by:
decode
in interfaceSerializer
- Parameters:
encoded
- the encoded string- Returns:
- the decoded object
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-