public class CamelMessage
extends java.lang.Object
implements scala.Serializable, scala.Product
Constructor and Description |
---|
CamelMessage(java.lang.Object body,
java.util.Map<java.lang.String,java.lang.Object> headers) |
CamelMessage(java.lang.Object body,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers) |
CamelMessage(java.lang.Object body,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers,
scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments) |
CamelMessage(java.lang.Object body,
java.util.Map<java.lang.String,java.lang.Object> headers,
java.util.Map<java.lang.String,javax.activation.DataHandler> attachments) |
Modifier and Type | Method and Description |
---|---|
static CamelMessage |
apply(java.lang.Object body,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Returns a new CamelMessage based on the
body and headers . |
static CamelMessage |
apply(java.lang.Object body,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers,
scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
Returns a new CamelMessage based on the
body , headers and attachments . |
scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> |
attachments() |
scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> |
attachments(scala.collection.immutable.Set<java.lang.String> names)
Returns those attachments from this message whose name is contained in
names . |
java.lang.Object |
body() |
<T> T |
bodyAs(scala.reflect.ClassTag<T> t,
org.apache.camel.CamelContext camelContext)
Returns the body of the message converted to the type
T . |
boolean |
canEqual(java.lang.Object that)
Indicates if some other object can be compared (based on type).
|
static CamelMessage |
canonicalize(java.lang.Object msg)
Creates a canonical form of the given message
msg . |
CamelMessage |
copy(java.lang.Object body,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers) |
static void |
copyContent(CamelMessage from,
org.apache.camel.Message to)
INTERNAL API
copies the content of this CamelMessageWithAttachments to an Apache Camel Message.
|
boolean |
equals(java.lang.Object that)
Indicates whether some other object is "equal to" this one.
|
static CamelMessage |
from(org.apache.camel.Message camelMessage,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
Creates a new CamelMessage object from the Camel message.
|
static CamelMessage |
from(org.apache.camel.Message camelMessage,
scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers,
scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
Creates a new CamelMessageWithAttachments object from the Camel message.
|
java.util.Map<java.lang.String,javax.activation.DataHandler> |
getAttachments()
Java API: Returns all attachments from this message.
|
java.util.Map<java.lang.String,javax.activation.DataHandler> |
getAttachments(java.util.Set<java.lang.String> names)
Java API: Returns those attachments from this message whose name is contained in
names . |
<T> T |
getBodyAs(java.lang.Class<T> clazz,
org.apache.camel.CamelContext camelContext)
Java API: Returns the body of the message converted to the type as given by the
clazz
parameter. |
<T> T |
getHeaderAs(java.lang.String name,
java.lang.Class<T> clazz,
org.apache.camel.CamelContext camelContext)
Java API: Returns the header by given
name parameter. |
java.util.Map<java.lang.String,java.lang.Object> |
getHeaders()
Java API: Returns all headers from this message.
|
java.util.Map<java.lang.String,java.lang.Object> |
getHeaders(java.util.Set<java.lang.String> names)
Java API: Returns those headers from this message whose name is contained in
names . |
int |
hashCode()
Returns a hash code value for the object.
|
<T> scala.util.Try<T> |
headerAs(java.lang.String name,
scala.reflect.ClassTag<T> t,
org.apache.camel.CamelContext camelContext)
Returns the header by given
name parameter in a Try . |
scala.collection.immutable.Map<java.lang.String,java.lang.Object> |
headers() |
scala.collection.immutable.Map<java.lang.String,java.lang.Object> |
headers(scala.collection.immutable.Set<java.lang.String> names)
Returns those headers from this message whose name is contained in
names . |
<A,B> CamelMessage |
mapBody(scala.Function1<A,B> transformer)
Returns a new CamelMessage with a transformed body using a
transformer function. |
<A,B> CamelMessage |
mapBody(Mapper<A,B> transformer)
Java API: Returns a new CamelMessage with a transformed body using a
transformer function. |
static java.lang.String |
MessageExchangeId()
CamelMessage header to correlate request with response messages.
|
int |
productArity()
Returns the size of this product.
|
java.lang.Object |
productElement(int n)
Returns the n-th element of this product, 0-based.
|
static scala.collection.Iterator<java.lang.Object> |
productIterator() |
static java.lang.String |
productPrefix() |
void |
resetStreamCache()
Reset StreamCache body.
|
java.lang.String |
toString() |
static scala.Option<scala.Tuple2<java.lang.Object,scala.collection.immutable.Map<java.lang.String,java.lang.Object>>> |
unapply(CamelMessage camelMessage)
Returns
Some(body, headers) . |
CamelMessage |
withAttachments(java.util.Map<java.lang.String,javax.activation.DataHandler> attachments)
Java API: Creates a new CamelMessage with given
attachments . |
CamelMessage |
withAttachments(scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
SCALA API: Creates a new CamelMessage with given
attachments . |
<T> CamelMessage |
withBody(T body)
Java API: Returns a new CamelMessage with a new body, while keeping the same headers.
|
<T> CamelMessage |
withBodyAs(java.lang.Class<T> clazz,
org.apache.camel.CamelContext camelContext)
Java API: Creates a CamelMessage with current
body converted to type clazz . |
<T> CamelMessage |
withBodyAs(scala.reflect.ClassTag<T> t,
org.apache.camel.CamelContext camelContext)
Creates a CamelMessage with current
body converted to type T . |
<A> CamelMessage |
withHeaders(java.util.Map<java.lang.String,A> headers)
Java API: Creates a new CamelMessage with given
headers . |
public CamelMessage(java.lang.Object body, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers, scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
public CamelMessage(java.lang.Object body, java.util.Map<java.lang.String,java.lang.Object> headers)
public CamelMessage(java.lang.Object body, java.util.Map<java.lang.String,java.lang.Object> headers, java.util.Map<java.lang.String,javax.activation.DataHandler> attachments)
public CamelMessage(java.lang.Object body, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
public static CamelMessage apply(java.lang.Object body, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
body
and headers
.body
- (undocumented)headers
- (undocumented)public static CamelMessage apply(java.lang.Object body, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers, scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
body
, headers
and attachments
.body
- (undocumented)headers
- (undocumented)attachments
- (undocumented)public static scala.Option<scala.Tuple2<java.lang.Object,scala.collection.immutable.Map<java.lang.String,java.lang.Object>>> unapply(CamelMessage camelMessage)
Some(body, headers)
.camelMessage
- (undocumented)public static java.lang.String MessageExchangeId()
public static CamelMessage canonicalize(java.lang.Object msg)
msg
. If msg
of type
CamelMessage then msg
is returned, otherwise msg
is set as body of a
newly created CamelMessage object.msg
- (undocumented)public static CamelMessage from(org.apache.camel.Message camelMessage, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
headers
- additional headers to set on the created CamelMessage in addition to those
in the Camel message.camelMessage
- (undocumented)public static CamelMessage from(org.apache.camel.Message camelMessage, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers, scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
headers
- additional headers to set on the created CamelMessageWithAttachments in addition to those
in the Camel message.attachments
- additional attachments to set on the created CamelMessageWithAttachments in addition to those
in the Camel message.camelMessage
- (undocumented)public static void copyContent(CamelMessage from, org.apache.camel.Message to)
from
- (undocumented)to
- (undocumented)public static scala.collection.Iterator<java.lang.Object> productIterator()
public static java.lang.String productPrefix()
public java.lang.Object body()
public scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers()
public scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments()
public CamelMessage copy(java.lang.Object body, scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers)
public java.lang.String toString()
toString
in class java.lang.Object
public scala.collection.immutable.Map<java.lang.String,java.lang.Object> headers(scala.collection.immutable.Set<java.lang.String> names)
names
.names
- (undocumented)public java.util.Map<java.lang.String,java.lang.Object> getHeaders(java.util.Set<java.lang.String> names)
names
.
The returned headers map is backed up by an immutable headers map. Any attempt to modify
the returned map will throw an exception.names
- (undocumented)public java.util.Map<java.lang.String,java.lang.Object> getHeaders()
public <A> CamelMessage withHeaders(java.util.Map<java.lang.String,A> headers)
headers
. A copy of the headers map is made.headers
- (undocumented)public <T> scala.util.Try<T> headerAs(java.lang.String name, scala.reflect.ClassTag<T> t, org.apache.camel.CamelContext camelContext)
name
parameter in a Try
. The header is converted to type T
, which is returned
in a Success
. If an exception occurs during the conversion to the type T
or when the header cannot be found,
the exception is returned in a Failure
.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.
name
- (undocumented)t
- (undocumented)camelContext
- (undocumented)public <T> T getHeaderAs(java.lang.String name, java.lang.Class<T> clazz, org.apache.camel.CamelContext camelContext)
name
parameter. The header is converted to type T
as defined by the clazz
parameter.
An exception is thrown when the conversion to the type T
fails or when the header cannot be found.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.
name
- (undocumented)clazz
- (undocumented)camelContext
- (undocumented)public <A,B> CamelMessage mapBody(scala.Function1<A,B> transformer)
transformer
function.
This method will throw a ClassCastException
if the body cannot be mapped to type A.transformer
- (undocumented)public <A,B> CamelMessage mapBody(Mapper<A,B> transformer)
transformer
function.
This method will throw a ClassCastException
if the body cannot be mapped to type A.transformer
- (undocumented)public <T> T bodyAs(scala.reflect.ClassTag<T> t, org.apache.camel.CamelContext camelContext)
T
. Conversion is done
using Camel's type converter. The type converter is obtained from the CamelContext that is passed in.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.t
- (undocumented)camelContext
- (undocumented)public <T> T getBodyAs(java.lang.Class<T> clazz, org.apache.camel.CamelContext camelContext)
clazz
parameter. Conversion is done using Camel's type converter. The type converter is obtained
from the CamelContext that is passed in.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.
clazz
- (undocumented)camelContext
- (undocumented)public void resetStreamCache()
public <T> CamelMessage withBody(T body)
body
- (undocumented)public <T> CamelMessage withBodyAs(scala.reflect.ClassTag<T> t, org.apache.camel.CamelContext camelContext)
body
converted to type T
.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.t
- (undocumented)camelContext
- (undocumented)public <T> CamelMessage withBodyAs(java.lang.Class<T> clazz, org.apache.camel.CamelContext camelContext)
body
converted to type clazz
.
The CamelContext is accessible in a UntypedConsumerActor
and UntypedProducerActor
using the getCamelContext
method, and is available on the CamelExtension
.
clazz
- (undocumented)camelContext
- (undocumented)public scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments(scala.collection.immutable.Set<java.lang.String> names)
names
.names
- (undocumented)public java.util.Map<java.lang.String,javax.activation.DataHandler> getAttachments(java.util.Set<java.lang.String> names)
names
.
The returned headers map is backed up by an immutable headers map. Any attempt to modify
the returned map will throw an exception.names
- (undocumented)public java.util.Map<java.lang.String,javax.activation.DataHandler> getAttachments()
public CamelMessage withAttachments(java.util.Map<java.lang.String,javax.activation.DataHandler> attachments)
attachments
. A copy of the attachments map is made.attachments
- (undocumented)public CamelMessage withAttachments(scala.collection.immutable.Map<java.lang.String,javax.activation.DataHandler> attachments)
attachments
.attachments
- (undocumented)public boolean equals(java.lang.Object that)
equals
in interface scala.Equals
equals
in class java.lang.Object
that
- (undocumented)public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object productElement(int n)
productElement
in interface scala.Product
n
- (undocumented)public int productArity()
productArity
in interface scala.Product
public boolean canEqual(java.lang.Object that)
canEqual
in interface scala.Equals
that
- (undocumented)