Construct an {@code AbstractMessageConverter} supporting a single MIME type. @param supportedMimeType the supported MIME type
Construct an {@code AbstractMessageConverter} supporting multiple MIME types. @param supportedMimeTypes the supported MIME types
Convert the message payload from serialized form to an Object. @param message the input message @param targetClass the target class for the conversion @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the result of the conversion, or {@code null} if the converter cannot perform the conversion @since 4.2
Convert the payload object to serialized form. @param payload the Object to convert @param headers optional headers for the message (may be {@code null}) @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the resulting payload for the message, or {@code null} if the converter cannot perform the conversion @since 4.2
Return the configured {@link ContentTypeResolver}.
Returns the default content type for the payload. Called when {@link #toMessage(Object, MessageHeaders)} is invoked without message headers or without a content type header. <p>By default, this returns the first element of the {@link #getSupportedMimeTypes() supportedMimeTypes}, if any. Can be overridden in sub-classes. @param payload the payload being converted to message @return the content type, or {@code null} if not known
Return the supported MIME types.
Whether content type resolution must produce a value that matches one of the supported MIME types.
Configure the {@link ContentTypeResolver} to use to resolve the content type of an input message. <p>Note that if no resolver is configured, then {@link #setStrictContentTypeMatch() strictContentTypeMatch} should be left as {@code false} (the default) or otherwise this converter will ignore all messages. <p>By default, a {@code DefaultContentTypeResolver} instance is used.
Whether this converter should convert messages for which no content type could be resolved through the configured {@link hunt.stomp.converter.ContentTypeResolver}. <p>A converter can configured to be strict only when a {@link #setContentTypeResolver contentTypeResolver} is configured and the list of {@link #getSupportedMimeTypes() supportedMimeTypes} is not be empty. <p>When this flag is set to {@code true}, {@link #supportsMimeType(MessageHeaders)} will return {@code false} if the {@link #setContentTypeResolver contentTypeResolver} is not defined or if no content-type header is present.
Whether the given class is supported by this converter. @param clazz the class to test for support @return {@code true} if supported; {@code false} otherwise
A variant of {@link #fromMessage(Message, Class)} which takes an extra conversion context as an argument, allowing to take e.g. annotations on a payload parameter into account. @param message the input message @param targetClass the target class for the conversion @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the result of the conversion, or {@code null} if the converter cannot perform the conversion @see #fromMessage(Message, Class)
A variant of {@link #toMessage(Object, MessageHeaders)} which takes an extra conversion context as an argument, allowing to take e.g. annotations on a return type into account. @param payload the Object to convert @param headers optional headers for the message (may be {@code null}) @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the new message, or {@code null} if the converter does not support the Object type or the target media type @see #toMessage(Object, MessageHeaders)
Abstract base class for {@link 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.
@author Rossen Stoyanchev @author Sebastien Deleuze @author Juergen Hoeller @since 4.0