Package org.apache.nifi.c2.serializer
Class C2JacksonSerializer
java.lang.Object
org.apache.nifi.c2.serializer.C2JacksonSerializer
- All Implemented Interfaces:
C2Serializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
objectMapper
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
C2JacksonSerializer
public C2JacksonSerializer()
-
-
Method Details
-
serialize
Description copied from interface:C2SerializerHelper to serialise object- Specified by:
serializein interfaceC2Serializer- Type Parameters:
T- the type of the object- Parameters:
object- object to be serialised- Returns:
- the serialised string representation of the parameter object if it was successful empty otherwise
-
deserialize
Description copied from interface:C2SerializerHelper to deserialize an object- Specified by:
deserializein interfaceC2Serializer- Type Parameters:
T- the type of the target object- Parameters:
content- the string representation of the object to be deserializedvalueType- the class of the target object- Returns:
- the deserialised object if successful empty otherwise
-
convert
public <T> Optional<T> convert(Object content, com.fasterxml.jackson.core.type.TypeReference<T> valueType) Description copied from interface:C2SerializerHelper to convert a JSON object into a specific type- Specified by:
convertin interfaceC2Serializer- Type Parameters:
T- the type of the target object- Parameters:
content- the string representation of the object to be deserializedvalueType- the class of the target object- Returns:
- the converted object if the conversion was successful empty otherwise
-