Table of Contents

Class AbstractMessageConverter

Namespace
Steeltoe.Messaging.Converter
Assembly
Steeltoe.Messaging.MessagingBase.dll
public abstract class AbstractMessageConverter : ISmartMessageConverter, IMessageConverter, IServiceNameAware
Inheritance
AbstractMessageConverter
Implements
Derived
Inherited Members

Constructors

AbstractMessageConverter(MimeType)

protected AbstractMessageConverter(MimeType supportedMimeType)

Parameters

supportedMimeType MimeType

AbstractMessageConverter(ICollection<MimeType>)

protected AbstractMessageConverter(ICollection<MimeType> supportedMimeTypes)

Parameters

supportedMimeTypes ICollection<MimeType>

Properties

ContentTypeResolver

public virtual IContentTypeResolver ContentTypeResolver { get; set; }

Property Value

IContentTypeResolver

SerializedPayloadClass

public virtual Type SerializedPayloadClass { get; set; }

Property Value

Type

ServiceName

public abstract string ServiceName { get; set; }

Property Value

string

StrictContentTypeMatch

public virtual bool StrictContentTypeMatch { get; set; }

Property Value

bool

SupportedMimeTypes

public virtual ICollection<MimeType> SupportedMimeTypes { get; }

Property Value

ICollection<MimeType>

Methods

CanConvertFrom(IMessage, Type)

public virtual bool CanConvertFrom(IMessage message, Type targetClass)

Parameters

message IMessage
targetClass Type

Returns

bool

CanConvertTo(object, IMessageHeaders)

public virtual bool CanConvertTo(object payload, IMessageHeaders headers = null)

Parameters

payload object
headers IMessageHeaders

Returns

bool

ConvertFromInternal(IMessage, Type, object)

protected virtual object ConvertFromInternal(IMessage message, Type targetClass, object conversionHint)

Parameters

message IMessage
targetClass Type
conversionHint object

Returns

object

ConvertToInternal(object, IMessageHeaders, object)

protected virtual object ConvertToInternal(object payload, IMessageHeaders headers, object conversionHint)

Parameters

payload object
headers IMessageHeaders
conversionHint object

Returns

object

FromMessage(IMessage, Type)

Convert the payload of a message to a typed object.

public virtual object FromMessage(IMessage message, Type targetClass)

Parameters

message IMessage

the input message

targetClass Type

the target type for the conversion

Returns

object

the result of the conversion

FromMessage(IMessage, Type, object)

Convert the payload of a message to a typed object.

public virtual object FromMessage(IMessage message, Type targetClass, object conversionHint)

Parameters

message IMessage

the input message

targetClass Type

the target type of the conversion

conversionHint object

an extra object passed to the converter which may used for handling the conversion

Returns

object

the result of the conversion

FromMessage<T>(IMessage)

Convert the payload of a message to a typed object.

public virtual T FromMessage<T>(IMessage message)

Parameters

message IMessage

the input message

Returns

T

the result of the conversion

Type Parameters

T

the target type for the conversion

FromMessage<T>(IMessage, object)

Convert the payload of a message to a typed object.

public virtual T FromMessage<T>(IMessage message, object conversionHint)

Parameters

message IMessage

the input message

conversionHint object

an extra object passed to the converter which may used for handling the conversion

Returns

T

the result of the conversion

Type Parameters

T

the target type for the conversion

GetDefaultContentType(object)

protected virtual MimeType GetDefaultContentType(object payload)

Parameters

payload object

Returns

MimeType

GetMimeType(IMessageHeaders)

protected virtual MimeType GetMimeType(IMessageHeaders headers)

Parameters

headers IMessageHeaders

Returns

MimeType

Supports(Type)

protected abstract bool Supports(Type clazz)

Parameters

clazz Type

Returns

bool

SupportsMimeType(IMessageHeaders)

protected virtual bool SupportsMimeType(IMessageHeaders headers)

Parameters

headers IMessageHeaders

Returns

bool

ToMessage(object, IMessageHeaders)

Create a message whose payload is the result of converting the given payload object to serialized form.

public virtual IMessage ToMessage(object payload, IMessageHeaders headers)

Parameters

payload object

the object to convert

headers IMessageHeaders

optional headers for the message

Returns

IMessage

the new messagee or null if converter does not support the payload type

ToMessage(object, IMessageHeaders, object)

Create a message whose payload is the result of converting the given payload object to serialized form.

public virtual IMessage ToMessage(object payload, IMessageHeaders headers, object conversionHint)

Parameters

payload object

the object to convert

headers IMessageHeaders

optional headers for the message

conversionHint object

an extra object passed to the converter which may used for handling the conversion

Returns

IMessage

the new messagee or null if converter does not support the payload type