public class DefaultMessageFactory extends AdaptrisMessageFactory
The default factory which returns implementations of AdaptrisMessage
.
In the adapter configuration file this class is aliased as default-message-factory which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
DefaultMessageFactory() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDefaultCharEncoding()
Return the default character encoding for the message.
|
AdaptrisMessage |
newMessage()
Returns a new
AdaptrisMessage . |
AdaptrisMessage |
newMessage(AdaptrisMessage source,
java.util.Collection<java.lang.String> metadataKeysToPreserve)
Returns a new
AdaptrisMessage with an empty payload but with
selected metadata from the source. |
AdaptrisMessage |
newMessage(byte[] payload)
Returns a new
AdaptrisMessage with the specified payload and
metadata. |
AdaptrisMessage |
newMessage(byte[] payload,
java.util.Set metadata)
Returns a new
AdaptrisMessage with the specified payload and metadata. |
AdaptrisMessage |
newMessage(java.lang.String payload)
Returns a new
AdaptrisMessage with the specified payload and
metadata. |
AdaptrisMessage |
newMessage(java.lang.String payload,
java.util.Set metadata)
Returns a new
AdaptrisMessage with the specified payload and
metadata. |
AdaptrisMessage |
newMessage(java.lang.String payload,
java.lang.String charEncoding)
Returns a new
AdaptrisMessage with the specified payload and
metadata. |
AdaptrisMessage |
newMessage(java.lang.String payload,
java.lang.String charEncoding,
java.util.Set metadata)
Returns a new
AdaptrisMessage with the specified payload and
metadata. |
void |
setDefaultCharEncoding(java.lang.String s)
Set the default character encoding to be applied to the message upon
creation.
|
defaultIfNull, getDefaultInstance, getUniqueIdGenerator, setUniqueIdGenerator, uniqueIdGenerator
public AdaptrisMessage newMessage(byte[] payload, java.util.Set metadata)
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and metadata.
newMessage
in class AdaptrisMessageFactory
payload
- the byte[]
payloadmetadata
- a Set
of MetadataElement
sAdaptrisMessage
public AdaptrisMessage newMessage(byte[] payload)
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and
metadata.
newMessage
in class AdaptrisMessageFactory
payload
- the byte[]
payloadAdaptrisMessage
public AdaptrisMessage newMessage(java.lang.String payload, java.util.Set metadata)
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and
metadata. Uses default platform character encoding.
newMessage
in class AdaptrisMessageFactory
payload
- the String
payloadmetadata
- a Set
of MetadataElement
sAdaptrisMessage
public AdaptrisMessage newMessage(java.lang.String payload)
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and
metadata. Uses default platform character encoding.
newMessage
in class AdaptrisMessageFactory
payload
- the String
payloadAdaptrisMessage
public AdaptrisMessage newMessage(java.lang.String payload, java.lang.String charEncoding, java.util.Set metadata) throws java.io.UnsupportedEncodingException
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and
metadata. Uses default platform character encoding.
newMessage
in class AdaptrisMessageFactory
payload
- the String
payloadcharEncoding
- the String
's character encodingmetadata
- a Set
of MetadataElement
sAdaptrisMessage
java.io.UnsupportedEncodingException
- if the passed character encoding is
not supportedpublic AdaptrisMessage newMessage(java.lang.String payload, java.lang.String charEncoding) throws java.io.UnsupportedEncodingException
AdaptrisMessageFactory
Returns a new AdaptrisMessage
with the specified payload and
metadata. Uses default platform character encoding.
newMessage
in class AdaptrisMessageFactory
payload
- the String
payloadcharEncoding
- the String
's character encodingAdaptrisMessage
java.io.UnsupportedEncodingException
- if the passed character encoding is
not supportedpublic AdaptrisMessage newMessage(AdaptrisMessage source, java.util.Collection<java.lang.String> metadataKeysToPreserve) throws java.lang.CloneNotSupportedException
AdaptrisMessageFactory
AdaptrisMessage
with an empty payload but with
selected metadata from the source.
The new AdaptrisMessage will have the same message id and MessageLifecycleEvent will be cloned from the original. Object metadata will also be preserved.
newMessage
in class AdaptrisMessageFactory
source
- the original AdaptrisMessagemetadataKeysToPreserve
- a list of keys to transfer to the new Message; if null, then all keys.AdaptrisMessage
java.lang.CloneNotSupportedException
- if the MleMarkers could not be cloned.public AdaptrisMessage newMessage()
AdaptrisMessageFactory
Returns a new AdaptrisMessage
. Payload and metadata are null.
newMessage
in class AdaptrisMessageFactory
AdaptrisMessage
with the specified payload and
metadatapublic java.lang.String getDefaultCharEncoding()
AdaptrisMessageFactory
getDefaultCharEncoding
in class AdaptrisMessageFactory
public void setDefaultCharEncoding(java.lang.String s)
If not explicitly configured, then the platform default character encoding will be used.
setDefaultCharEncoding
in class AdaptrisMessageFactory
s
- the defaultCharEncoding to setAdaptrisMessage.setCharEncoding(String)