public abstract class AbstractFromMessageConverter
extends org.springframework.messaging.converter.AbstractMessageConverter
MessageConverters
used with Spring XD Message conversion. Only AbstractMessageConverter.fromMessage(org.springframework.messaging.Message<?>, java.lang.Class<?>)
is supported.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
protected java.util.List<org.springframework.util.MimeType> |
targetMimeTypes |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> targetMimeTypes) |
protected |
AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> supportedSourceMimeTypes,
java.util.Collection<org.springframework.util.MimeType> targetMimeTypes,
org.springframework.messaging.converter.ContentTypeResolver contentTypeResolver)
Creates a converter that handles one or more content-type message headers and one or more target MIME types
|
protected |
AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> supportedSourceMimeTypes,
org.springframework.util.MimeType targetMimeType,
org.springframework.messaging.converter.ContentTypeResolver contentTypeResolver)
Creates a converter that handles one or more content-type message headers
|
protected |
AbstractFromMessageConverter(org.springframework.util.MimeType targetMimeType)
Creates a converter that ignores content-type message headers
|
protected |
AbstractFromMessageConverter(org.springframework.util.MimeType supportedSourceMimeType,
java.util.Collection<org.springframework.util.MimeType> targetMimeTypes)
Creates a converter that requires a specific content-type message header and supports multiple target MIME types.
|
protected |
AbstractFromMessageConverter(org.springframework.util.MimeType supportedSourceMimeType,
org.springframework.util.MimeType targetMimeType)
Creates a converter that requires a specific content-type message header
|
Modifier and Type | Method and Description |
---|---|
protected org.springframework.messaging.Message<?> |
buildConvertedMessage(java.lang.Object payload,
org.springframework.messaging.MessageHeaders headers,
org.springframework.util.MimeType contentType)
Convenience method to construct a converted message
|
protected boolean |
canConvertFrom(org.springframework.messaging.Message<?> message,
java.lang.Class<?> targetClass) |
protected boolean |
canConvertTo(java.lang.Object payload,
org.springframework.messaging.MessageHeaders headers)
Not supported by default
|
java.lang.Object |
convertToInternal(java.lang.Object payload,
org.springframework.messaging.MessageHeaders headers)
Not supported by default
|
void |
setContentTypeResolver(org.springframework.messaging.converter.ContentTypeResolver resolver) |
protected abstract java.lang.Class<?>[] |
supportedPayloadTypes()
Subclasses implement this to specify supported payload types
|
protected abstract java.lang.Class<?>[] |
supportedTargetTypes()
Subclasses implement this to specify supported target types
|
protected boolean |
supports(java.lang.Class<?> clazz) |
protected boolean |
supportsPayloadType(java.lang.Class<?> clazz) |
boolean |
supportsTargetMimeType(org.springframework.util.MimeType mimeType) |
convertFromInternal, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage
protected org.slf4j.Logger logger
protected final java.util.List<org.springframework.util.MimeType> targetMimeTypes
protected AbstractFromMessageConverter(org.springframework.util.MimeType targetMimeType)
targetMimeType
- the required target type (outputType or inputType for XD)protected AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> targetMimeTypes)
protected AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> supportedSourceMimeTypes, org.springframework.util.MimeType targetMimeType, org.springframework.messaging.converter.ContentTypeResolver contentTypeResolver)
supportedSourceMimeTypes
- list of MimeType
that may present in content-type headertargetMimeType
- the required target type (outputType or inputType for XD)protected AbstractFromMessageConverter(java.util.Collection<org.springframework.util.MimeType> supportedSourceMimeTypes, java.util.Collection<org.springframework.util.MimeType> targetMimeTypes, org.springframework.messaging.converter.ContentTypeResolver contentTypeResolver)
supportedSourceMimeTypes
- a list of supported content typestargetMimeTypes
- a list of supported target types (outputType or inputType for XD)contentTypeResolver
- the ContentTypeResolver
to useprotected AbstractFromMessageConverter(org.springframework.util.MimeType supportedSourceMimeType, org.springframework.util.MimeType targetMimeType)
supportedSourceMimeType
- MimeType
that must be present in content-type headertargetMimeType
- the required target type (outputType or inputType for XD)protected AbstractFromMessageConverter(org.springframework.util.MimeType supportedSourceMimeType, java.util.Collection<org.springframework.util.MimeType> targetMimeTypes)
supportedSourceMimeType
- MimeType
that must be present in content-type headertargetMimeTypes
- a list of supported target types (outputType or inputType for XD)protected abstract java.lang.Class<?>[] supportedTargetTypes()
protected abstract java.lang.Class<?>[] supportedPayloadTypes()
protected boolean supportsPayloadType(java.lang.Class<?> clazz)
protected boolean supports(java.lang.Class<?> clazz)
supports
in class org.springframework.messaging.converter.AbstractMessageConverter
protected boolean canConvertFrom(org.springframework.messaging.Message<?> message, java.lang.Class<?> targetClass)
canConvertFrom
in class org.springframework.messaging.converter.AbstractMessageConverter
public boolean supportsTargetMimeType(org.springframework.util.MimeType mimeType)
public void setContentTypeResolver(org.springframework.messaging.converter.ContentTypeResolver resolver)
setContentTypeResolver
in class org.springframework.messaging.converter.AbstractMessageConverter
protected boolean canConvertTo(java.lang.Object payload, org.springframework.messaging.MessageHeaders headers)
canConvertTo
in class org.springframework.messaging.converter.AbstractMessageConverter
public java.lang.Object convertToInternal(java.lang.Object payload, org.springframework.messaging.MessageHeaders headers)
convertToInternal
in class org.springframework.messaging.converter.AbstractMessageConverter
protected final org.springframework.messaging.Message<?> buildConvertedMessage(java.lang.Object payload, org.springframework.messaging.MessageHeaders headers, org.springframework.util.MimeType contentType)
payload
- the converted payloadheaders
- the existing message headerscontentType
- the value of the content-type header