Class Transformers
java.lang.Object
org.springframework.integration.dsl.Transformers
public abstract class Transformers extends Object
An utility class to provide methods for out-of-the-box
Transformer
s.- Since:
- 5.0
- Author:
- Artem Bilan
-
Constructor Summary
Constructors Constructor Description Transformers()
-
Method Summary
-
Constructor Details
-
Transformers
public Transformers()
-
-
Method Details
-
objectToString
-
objectToString
-
toMap
-
toMap
-
toMap
-
toMap
public static ObjectToMapTransformer toMap(JsonObjectMapper<?,?> jsonObjectMapper, boolean shouldFlattenKeys) -
fromMap
-
fromMap
-
toJson
-
toJson
-
toJson
public static ObjectToJsonTransformer toJson(@Nullable JsonObjectMapper<?,?> jsonObjectMapper, @Nullable ObjectToJsonTransformer.ResultType resultType) -
toJson
-
toJson
public static ObjectToJsonTransformer toJson(@Nullable JsonObjectMapper<?,?> jsonObjectMapper, @Nullable String contentType) -
toJson
public static ObjectToJsonTransformer toJson(@Nullable ObjectToJsonTransformer.ResultType resultType)Factory for theObjectToJsonTransformer
based on the providedObjectToJsonTransformer.ResultType
.- Parameters:
resultType
- theObjectToJsonTransformer.ResultType
to use. Defaults toObjectToJsonTransformer.ResultType.STRING
.- Returns:
- the ObjectToJsonTransformer
- Since:
- 5.0.9
-
toJson
public static ObjectToJsonTransformer toJson(@Nullable ObjectToJsonTransformer.ResultType resultType, @Nullable String contentType) -
toJson
public static ObjectToJsonTransformer toJson(@Nullable JsonObjectMapper<?,?> jsonObjectMapper, @Nullable ObjectToJsonTransformer.ResultType resultType, @Nullable String contentType) -
fromJson
-
fromJson
-
fromJson
Construct aJsonToObjectTransformer
based on the providedResolvableType
.- Parameters:
targetType
- theResolvableType
top use.- Returns:
- the
JsonToObjectTransformer
instance. - Since:
- 5.2
-
fromJson
-
fromJson
public static JsonToObjectTransformer fromJson(@Nullable Class<?> targetClass, @Nullable JsonObjectMapper<?,?> jsonObjectMapper) -
fromJson
public static JsonToObjectTransformer fromJson(ResolvableType targetType, @Nullable JsonObjectMapper<?,?> jsonObjectMapper)- Parameters:
targetType
- theResolvableType
top use.jsonObjectMapper
- theJsonObjectMapper
top use.- Returns:
- the
JsonToObjectTransformer
instance. - Since:
- 5.2
-
serializer
-
serializer
-
deserializer
-
deserializer
public static PayloadDeserializingTransformer deserializer(@Nullable Deserializer<Object> deserializer, String... allowedPatterns) -
converter
-
syslogToMap
-
encoding
The factory method for theEncodingPayloadTransformer
.- Type Parameters:
T
- thepayload
type.- Parameters:
codec
- theCodec
to use.- Returns:
- the
EncodingPayloadTransformer
instance.
-
decoding
The factory method for theDecodingTransformer
.- Type Parameters:
T
- the target type.- Parameters:
codec
- theCodec
to use.type
- the target type to transform to.- Returns:
- the
DecodingTransformer
instance.
-
decoding
The factory method for theDecodingTransformer
.- Type Parameters:
T
- the target type.- Parameters:
codec
- theCodec
to use.typeExpression
- the target type SpEL expression.- Returns:
- the
DecodingTransformer
instance.
-
decoding
public static <T> DecodingTransformer<T> decoding(Codec codec, Function<Message<?>,Class<T>> typeFunction)The factory method for theDecodingTransformer
.- Type Parameters:
T
- the target type.- Parameters:
codec
- theCodec
to use.typeFunction
- the target type function.- Returns:
- the
DecodingTransformer
instance.
-
decoding
The factory method for theDecodingTransformer
.- Type Parameters:
T
- the target type.- Parameters:
codec
- theCodec
to use.typeExpression
- the target type SpEL expression.- Returns:
- the
DecodingTransformer
instance.
-
fromStream
The factory method for theStreamTransformer
.- Returns:
- the
StreamTransformer
instance.
-
fromStream
Create an instance with the charset to convert the stream to a String; if null abyte[]
will be produced instead.- Parameters:
charset
- the charset.- Returns:
- the
StreamTransformer
instance.
-