SmartMessageConverter implementations including
support for common properties and a partial implementation of the conversion methods,
mainly to check if the converter supports the conversion based on the payload class
and MIME type.
| Modifier and Type | Field and Description |
|---|---|
| private ContentTypeResolver | |
| protected final Log | |
| private Class | |
| private boolean | |
| private final List |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| protected | AbstractMessageConverter(Collection<MimeType> supportedMimeTypes)
Constructor with Collection of MIME types. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addSupportedMimeTypes(MimeType... supportedMimeTypes)
Allows subclasses to add more supported mime types. |
| protected boolean | |
| protected boolean | |
| protected Object | Returns: the result of the conversion, ornull if the converter cannot
perform the conversionthe input message message, Class<?> the target class for the conversion targetClass, Object conversionHint)Convert the message payload from serialized form to an Object. |
| protected Object | Returns: the resulting payload for the message, ornull if the converter
cannot perform the conversionthe Object to convert payload, MessageHeaders optional headers for the message (may be headers, Object conversionHint)null)Convert the payload object to serialized form. |
| public final Object | fromMessage(Message<?>
the input message message, Class<?> the target class for the conversion targetClass)Implements org. Message from a serialized form to a typed Object
of the specified target class.
|
| public final Object | fromMessage(Message<?>
the input message message, Class<?> the target class for the conversion targetClass, Object conversionHint)Implements org. fromMessage(Message, Class) which takes an extra
conversion context as an argument, allowing to take e.g. annotations
on a payload parameter into account.
|
| public ContentTypeResolver | |
| protected MimeType | Returns: the content type, ornull if not knownthe payload being converted to a message payload)Return the default content type for the payload. |
| protected MimeType | |
| pack-priv static Type | |
| public Class | |
| public List | |
| public boolean | isStrictContentTypeMatch()
Whether content type resolution must produce a value that matches one of the supported MIME types. |
| public void | setContentTypeResolver(ContentTypeResolver resolver)
Configure a |
| public void | setSerializedPayloadClass(Class<?>
either byte[] or String payloadClass)Configure the preferred serialization class to use (byte[] or String) when
converting an Object payload to a |
| public void | setStrictContentTypeMatch(boolean strictContentTypeMatch)
Whether this converter should convert messages for which no content type
can be resolved through the configured
|
| protected abstract boolean | |
| protected boolean | |
| public final Message | toMessage(Object
the Object to convert payload, MessageHeaders optional headers for the message (may be headers)null)Implements org. Message whose payload is the result of converting the given
payload Object to serialized form.
|
| public final Message | toMessage(Object
the Object to convert payload, MessageHeaders optional headers for the message (may be headers, Object conversionHint)null)Implements org. toMessage(Object, MessageHeaders) which takes an extra
conversion context as an argument, allowing to take e.g. annotations
on a return type into account.
|
| contentTypeResolver | back to summary |
|---|---|
| private ContentTypeResolver contentTypeResolver
| |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| serializedPayloadClass | back to summary |
|---|---|
| private Class<?> serializedPayloadClass | |
| strictContentTypeMatch | back to summary |
|---|---|
| private boolean strictContentTypeMatch | |
| supportedMimeTypes | back to summary |
|---|---|
| private final List<MimeType> supportedMimeTypes | |
| AbstractMessageConverter | back to summary |
|---|---|
| protected AbstractMessageConverter(MimeType supportedMimeType) Constructor with a single MIME type. | |
| AbstractMessageConverter | back to summary |
|---|---|
| protected AbstractMessageConverter(MimeType... supportedMimeTypes) Constructor with multiple MIME types.
| |
| AbstractMessageConverter | back to summary |
|---|---|
| protected AbstractMessageConverter(Collection<MimeType> supportedMimeTypes) Constructor with Collection of MIME types. | |
| addSupportedMimeTypes | back to summary |
|---|---|
| protected void addSupportedMimeTypes(MimeType... supportedMimeTypes) Allows subclasses to add more supported mime types.
| |
| canConvertFrom | back to summary |
|---|---|
| protected boolean canConvertFrom(Message<?> message, Class<?> targetClass) | |
| canConvertTo | back to summary |
|---|---|
| protected boolean canConvertTo(Object payload, MessageHeaders headers) | |
| convertFromInternal | back to summary |
|---|---|
| protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) Convert the message payload from serialized form to an Object.
| |
| convertToInternal | back to summary |
|---|---|
| protected Object convertToInternal(Object payload, MessageHeaders headers, Object conversionHint) Convert the payload object to serialized form.
| |
| fromMessage | back to summary |
|---|---|
| public final Object fromMessage(Message<?> message, Class<?> targetClass) Implements org. Doc from org. Convert the payload of a If the converter does not support the specified media type or cannot perform
the conversion, it should return | |
| fromMessage | back to summary |
|---|---|
| public final Object fromMessage(Message<?> message, Class<?> targetClass, Object conversionHint) Implements org. Doc from org. A variant of
| |
| getContentTypeResolver | back to summary |
|---|---|
| public ContentTypeResolver getContentTypeResolver() Return the
| |
| getDefaultContentType | back to summary |
|---|---|
| protected MimeType getDefaultContentType(Object payload) Return the default content type for the payload. Called when
By default, this returns the first element of the
| |
| getMimeType | back to summary |
|---|---|
protected MimeType getMimeType(MessageHeaders headers)
| |
| getResolvedType | back to summary |
|---|---|
| pack-priv static Type getResolvedType(Class<?> targetClass, Object conversionHint) | |
| getSerializedPayloadClass | back to summary |
|---|---|
| public Class Return the configured preferred serialization payload class. | |
| getSupportedMimeTypes | back to summary |
|---|---|
| public List Return the supported MIME types. | |
| isStrictContentTypeMatch | back to summary |
|---|---|
| public boolean isStrictContentTypeMatch() Whether content type resolution must produce a value that matches one of the supported MIME types. | |
| setContentTypeResolver | back to summary |
|---|---|
| public void setContentTypeResolver(ContentTypeResolver resolver) Configure a By default, a Note if the resolver is set to | |
| setSerializedPayloadClass | back to summary |
|---|---|
| public void setSerializedPayloadClass(Class<?> payloadClass) Configure the preferred serialization class to use (byte[] or String) when
converting an Object payload to a The default value is byte[].
| |
| setStrictContentTypeMatch | back to summary |
|---|---|
| public void setStrictContentTypeMatch(boolean strictContentTypeMatch) Whether this converter should convert messages for which no content type
can be resolved through the configured
A converter can be configured to be strict only when a
When this flag is set to | |
| supports | back to summary |
|---|---|
| protected abstract boolean supports(Class<?> clazz) Whether the given class is supported by this converter.
| |
| supportsMimeType | back to summary |
|---|---|
| protected boolean supportsMimeType(MessageHeaders headers) | |
| toMessage | back to summary |
|---|---|
| public final Message Implements org. Doc from org. Create a If the converter does not support the specified media type or cannot perform
the conversion, it should return
| |
| toMessage | back to summary |
|---|---|
| public final Message Implements org. Doc from org. A variant of
| |