R
- The type of return value contained in this responsepublic class GenericQueryResponseMessage<R> extends MessageDecorator<R> implements QueryResponseMessage<R>
Constructor and Description |
---|
GenericQueryResponseMessage(Message<R> delegate)
Copy-constructor that takes the payload, meta data and message identifier of the given
delegate for this
message. |
GenericQueryResponseMessage(R result)
Initialize the response message with given
result . |
GenericQueryResponseMessage(R result,
Map<String,?> metaData)
Initialize the response message with given
result . |
Modifier and Type | Method and Description |
---|---|
QueryResponseMessage<R> |
andMetaData(Map<String,?> additionalMetaData)
Returns a copy of this QueryResponseMessage with its MetaData merged with given
metaData . |
static <R> QueryResponseMessage<R> |
asResponseMessage(Object result)
Creates a QueryResponseMessage for the given
result . |
QueryResponseMessage<R> |
withMetaData(Map<String,?> metaData)
Returns a copy of this QueryResponseMessage with the given
metaData . |
describeTo, describeType, getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdentifier, getMetaData, getPayload, getPayloadType
public GenericQueryResponseMessage(R result)
result
.result
- The result reported by the Query Handlerpublic GenericQueryResponseMessage(R result, Map<String,?> metaData)
result
.result
- The result reported by the Query HandlermetaData
- The meta data to contain in the messagepublic GenericQueryResponseMessage(Message<R> delegate)
delegate
for this
message.
Unlike the other constructors, this constructor will not attempt to retrieve any correlation data from the Unit of Work.
delegate
- The message to retrieve message details frompublic static <R> QueryResponseMessage<R> asResponseMessage(Object result)
result
. If result already implements QueryResponseMessage,
it is returned directly. Otherwise a new QueryResponseMessage is created with the result as payload. An attempt
is made to detect collection-like structures (see CollectionUtils.asCollection(Object)
) in the given
result
, converting it to a Collection is possible.R
- The type of response expectedresult
- The result of a Query, to be wrapped in a QueryResponseMessageresult
, or the result itself, if already a
QueryResponseMessage.public QueryResponseMessage<R> withMetaData(Map<String,?> metaData)
QueryResponseMessage
metaData
. The payload remains unchanged.withMetaData
in interface Message<R>
withMetaData
in interface QueryResponseMessage<R>
metaData
- The new MetaData for the QueryResponseMessagepublic QueryResponseMessage<R> andMetaData(Map<String,?> additionalMetaData)
QueryResponseMessage
metaData
. The payload
remains unchanged.andMetaData
in interface Message<R>
andMetaData
in interface QueryResponseMessage<R>
additionalMetaData
- The MetaData to merge into the QueryResponseMessageCopyright © 2010–2018. All rights reserved.