- All Implemented Interfaces:
Converter<String,
,Object> Decoder<String,
,Object> Encoder<Object,
,String> JoinableEncoder<Object,
,String> ReactiveConverter<String,
,Object> ReactiveDecoder<String,
,Object> ReactiveEncoder<Object,
,String> SplittableDecoder<String,
Object>
JSON String to Object converter backed by an ObjectMapper
.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
- See Also:
-
Constructor Summary
ConstructorDescriptionJacksonStringConverter
(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a JSON String converter. -
Method Summary
Modifier and TypeMethodDescription<T> T
Decodes the specified value to an object whose type is represented by the specified class.<T> T
Decodes the specified value to an object of the specified type.<T> Flux
<T> decodeMany
(Publisher<String> value, Class<T> type) Decodes the specified stream of values whose type is represented by the specified class into a flux stream of values.<T> Flux
<T> decodeMany
(Publisher<String> value, Type type) Decodes the specified stream of values whose type is the specified type into a flux stream of values.<T> Mono
<T> Decodes the specified stream of values whose type is represented by the specified class into a mono stream of values.<T> Mono
<T> Decodes the specified stream of values whose type is the specified type into a mono stream of value.<T> T[]
decodeToArray
(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to an array of decoded values.<T> T[]
decodeToArray
(String value, Type type) Decodes the specified value whose type is the specified type to an array of decoded values.<T> List
<T> decodeToList
(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to a list of decoded values.<T> List
<T> decodeToList
(String value, Type type) Decodes the specified value whose type is the specified type to a list of decoded values.<T> Set
<T> decodeToSet
(String value, Class<T> type) Decodes the specified value whose type is represented by the specified class to a set of decoded values.<T> Set
<T> decodeToSet
(String value, Type type) Decodes the specified value whose type is the specified type to a set of decoded values.<T> String
encode
(T value) Encodes the specified value to the encoded type.<T> String
Encodes the specified value whose type is represented by the specified class to the encoded type.<T> String
Encodes the specified value whose type is the specified type to the encoded type.<T> String
encodeArray
(T[] value) Encodes the specified array of values to the encoded type.<T> String
encodeArray
(T[] value, Class<T> type) Encodes the specified array of values whose type is represented by the specified class to the encoded type.<T> String
encodeArray
(T[] value, Type type) Encodes the specified array of values whose type is represented by the specified class to the encoded type.<T> String
encodeList
(List<T> value) Encodes the specified list of values to an encoded value.<T> String
encodeList
(List<T> value, Class<T> type) Encodes the specified list of values whose type is represented by the specified class to an encoded value.<T> String
encodeList
(List<T> value, Type type) Encodes the specified list of values whose type is the specified type to an encoded value.encodeMany
(Flux<T> value) Encodes a flux stream of values to a stream of values.encodeMany
(Flux<T> value, Class<T> type) Encodes a flux stream of values whose type is represented by the specified class to a stream of values.encodeMany
(Flux<T> value, Type type) Encodes a flux stream of values whose type is the specified type to a stream of values.Encodes a mono stream of values to a stream of values.Encodes a mono stream of values whose type is represented by the specified class to a stream of values.Encodes a mono stream of values whose type is the specified type to a stream of values.<T> String
Encodes the specified set of values to an encoded value.<T> String
Encodes the specified set of values whose type is represented by the specified class to an encoded value.<T> String
Encodes the specified set of values whose type is the specified type to an encoded value.
-
Constructor Details
-
JacksonStringConverter
public JacksonStringConverter(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a JSON String converter.
- Parameters:
mapper
- a Jackson object mapper
-
-
Method Details
-
encodeOne
Description copied from interface:ReactiveEncoder
Encodes a mono stream of values to a stream of values.
- Specified by:
encodeOne
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the mono stream of values to encode- Returns:
- a stream of encoded values
-
encodeOne
Description copied from interface:ReactiveEncoder
Encodes a mono stream of values whose type is represented by the specified class to a stream of values.
- Specified by:
encodeOne
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the mono stream of values to encodetype
- the class of the decoded object- Returns:
- a stream of encoded values
-
encodeOne
Description copied from interface:ReactiveEncoder
Encodes a mono stream of values whose type is the specified type to a stream of values.
- Specified by:
encodeOne
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the mono stream of values to encodetype
- the type of the decoded object- Returns:
- a stream of encoded values
-
encodeMany
Description copied from interface:ReactiveEncoder
Encodes a flux stream of values to a stream of values.
- Specified by:
encodeMany
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the flux stream of values to encode- Returns:
- a stream of encoded values
-
encodeMany
Description copied from interface:ReactiveEncoder
Encodes a flux stream of values whose type is represented by the specified class to a stream of values.
- Specified by:
encodeMany
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the flux stream of values to encodetype
- the class of the decoded object- Returns:
- a stream of encoded values
-
encodeMany
Description copied from interface:ReactiveEncoder
Encodes a flux stream of values whose type is the specified type to a stream of values.
- Specified by:
encodeMany
in interfaceReactiveEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the flux stream of values to encodetype
- the type of the decoded object- Returns:
- a stream of encoded values
-
encode
Description copied from interface:Encoder
Encodes the specified value to the encoded type.
- Specified by:
encode
in interfaceEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the object to encode- Returns:
- an encoded object
- Throws:
ConverterException
- if there was an error encoding the value
-
encode
Description copied from interface:Encoder
Encodes the specified value whose type is represented by the specified class to the encoded type.
- Specified by:
encode
in interfaceEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the object to encodetype
- the class of the decoded object- Returns:
- an encoded object
- Throws:
ConverterException
- if there was an error encoding the value
-
encode
Description copied from interface:Encoder
Encodes the specified value whose type is the specified type to the encoded type.
- Specified by:
encode
in interfaceEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the object to encodetype
- the type of the decoded object- Returns:
- an encoded object
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeList
Description copied from interface:JoinableEncoder
Encodes the specified list of values to an encoded value.
- Specified by:
encodeList
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the list of objects to encode- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeList
Description copied from interface:JoinableEncoder
Encodes the specified list of values whose type is represented by the specified class to an encoded value.
- Specified by:
encodeList
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the list of objects to encodetype
- the class of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeList
Description copied from interface:JoinableEncoder
Encodes the specified list of values whose type is the specified type to an encoded value.
- Specified by:
encodeList
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the list of objects to encodetype
- the type of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeSet
Description copied from interface:JoinableEncoder
Encodes the specified set of values to an encoded value.
- Specified by:
encodeSet
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the set of objects to encode- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeSet
Description copied from interface:JoinableEncoder
Encodes the specified set of values whose type is represented by the specified class to an encoded value.
- Specified by:
encodeSet
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the set of objects to encodetype
- the class of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeSet
Description copied from interface:JoinableEncoder
Encodes the specified set of values whose type is the specified type to an encoded value.
- Specified by:
encodeSet
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the set of objects to encodetype
- the type of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeArray
Description copied from interface:JoinableEncoder
Encodes the specified array of values to the encoded type.
- Specified by:
encodeArray
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the array of objects to encode- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeArray
Description copied from interface:JoinableEncoder
Encodes the specified array of values whose type is represented by the specified class to the encoded type.
- Specified by:
encodeArray
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the array of objects to encodetype
- the class of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
encodeArray
Description copied from interface:JoinableEncoder
Encodes the specified array of values whose type is represented by the specified class to the encoded type.
- Specified by:
encodeArray
in interfaceJoinableEncoder<Object,
String> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the array of objects to encodetype
- the class of the decoded object- Returns:
- an encoded value
- Throws:
ConverterException
- if there was an error encoding the value
-
decodeOne
Description copied from interface:ReactiveDecoder
Decodes the specified stream of values whose type is represented by the specified class into a mono stream of values.
- Specified by:
decodeOne
in interfaceReactiveDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the stream of values to decodetype
- the class of the decoded object- Returns:
- a mono emitting the decoded value
-
decodeOne
Description copied from interface:ReactiveDecoder
Decodes the specified stream of values whose type is the specified type into a mono stream of value.
- Specified by:
decodeOne
in interfaceReactiveDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the stream of values to decodetype
- the type of the decoded object- Returns:
- a mono emitting the decoded value
-
decodeMany
Description copied from interface:ReactiveDecoder
Decodes the specified stream of values whose type is represented by the specified class into a flux stream of values.
- Specified by:
decodeMany
in interfaceReactiveDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the stream of values to decodetype
- the class of the decoded object- Returns:
- a flux emitting the decoded values
-
decodeMany
Description copied from interface:ReactiveDecoder
Decodes the specified stream of values whose type is the specified type into a flux stream of values.
- Specified by:
decodeMany
in interfaceReactiveDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the stream of values to decodetype
- the type of the decoded object- Returns:
- a flux emitting the decoded values
-
decode
Description copied from interface:Decoder
Decodes the specified value to an object whose type is represented by the specified class.
- Specified by:
decode
in interfaceDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the object to decodetype
- the class of the decoded object- Returns:
- a decoded object
- Throws:
ConverterException
- if there was an error decoding the value
-
decode
Description copied from interface:Decoder
Decodes the specified value to an object of the specified type.
- Specified by:
decode
in interfaceDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the object to decodetype
- the type of the decoded object- Returns:
- a decoded object
- Throws:
ConverterException
- if there was an error decoding the value
-
decodeToList
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is represented by the specified class to a list of decoded values.
- Specified by:
decodeToList
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the class of the decoded object- Returns:
- a list of decoded values
-
decodeToList
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is the specified type to a list of decoded values.
- Specified by:
decodeToList
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the type of the decoded object- Returns:
- a list of decoded values
-
decodeToSet
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is represented by the specified class to a set of decoded values.
- Specified by:
decodeToSet
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the class of the decoded object- Returns:
- a set of decoded values
-
decodeToSet
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is the specified type to a set of decoded values.
- Specified by:
decodeToSet
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the type of the decoded object- Returns:
- a set of decoded values
-
decodeToArray
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is represented by the specified class to an array of decoded values.
- Specified by:
decodeToArray
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the class of the decoded object- Returns:
- an array of decoded values
-
decodeToArray
Description copied from interface:SplittableDecoder
Decodes the specified value whose type is the specified type to an array of decoded values.
- Specified by:
decodeToArray
in interfaceSplittableDecoder<String,
Object> - Type Parameters:
T
- the type of the decoded object- Parameters:
value
- the value to decodetype
- the type of the decoded object- Returns:
- an array of decoded values
-