R
- The type of return value contained in this responsepublic class GenericQueryResponseMessage<R> extends MessageDecorator<R> implements QueryResponseMessage<R>
Constructor and Description |
---|
GenericQueryResponseMessage(Class<R> declaredResultType,
R result)
Initialize a response message with given
result and declaredResultType . |
GenericQueryResponseMessage(Class<R> declaredResultType,
R result,
Map<String,?> metaData)
Initialize the response message with a specific
declaredResultType , the given result as payload
and metaData . |
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 and metaData . |
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> |
asNullableResponseMessage(Class<R> declaredType,
Object result)
Creates a QueryResponseMessage for the given
result with a declaredType as the result type. |
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 Handler, may not be null
public GenericQueryResponseMessage(Class<R> declaredResultType, R result)
result
and declaredResultType
. This constructor allows
the actual result to be null
.declaredResultType
- The declared type of the resultresult
- The actual result. May be null
public GenericQueryResponseMessage(R result, Map<String,?> metaData)
result
and metaData
.result
- The result reported by the Query Handler, may not be null
metaData
- The meta data to contain in the messagepublic GenericQueryResponseMessage(Class<R> declaredResultType, R result, Map<String,?> metaData)
declaredResultType
, the given result
as payload
and metaData
.declaredResultType
- A Class
denoting the declared result type of this query response
messageresult
- The result reported by the Query Handler, may be null
metaData
- 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.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 static <R> QueryResponseMessage<R> asNullableResponseMessage(Class<R> declaredType, Object result)
result
with a declaredType
as the result type.
Providing both the result type and the result allows the creation of a nullable response message, as the
implementation does not have to check the type itself, which could result in a
NullPointerException
. If result already implements QueryResponseMessage, it is returned
directly. Otherwise a new QueryResponseMessage is created with the declared type as the result type and the
result as payload.R
- The type of response expecteddeclaredType
- The declared type of the Query Response Message to be created.result
- 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.