T
- The type of payload expressing the query in this messageR
- The type of response expected from this querypublic class GenericQueryMessage<T,R> extends MessageDecorator<T> implements QueryMessage<T,R>
queryName
of the
message is the fully qualified class name of the message's payload.Constructor and Description |
---|
GenericQueryMessage(Message<T> delegate,
String queryName,
Class<R> responseType)
Initialize the Query Message, using given
delegate as the carrier of payload and metadata and given
queryName and expecting the given responseType . |
GenericQueryMessage(T payload,
Class<R> responseType)
Initializes the message with the given
payload and expected responseType . |
GenericQueryMessage(T payload,
String queryName,
Class<R> responseType)
Initializes the message with the given
payload , queryName and expected responseType . |
Modifier and Type | Method and Description |
---|---|
QueryMessage<T,R> |
andMetaData(Map<String,?> metaData)
Returns a copy of this Message with it MetaData merged with the given
metaData . |
String |
getQueryName()
Returns the name identifying the query to be executed.
|
Class<R> |
getResponseType()
The type of response expected by the sender of the query
|
QueryMessage<T,R> |
withMetaData(Map<String,?> metaData)
Returns a copy of this Message with the given
metaData . |
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIdentifier, getMetaData, getPayload, getPayloadType
public GenericQueryMessage(T payload, Class<R> responseType)
payload
and expected responseType
. The query name is
set to the fully qualified class name of the payload
.payload
- The payload expressing the queryresponseType
- The expected response typepublic GenericQueryMessage(T payload, String queryName, Class<R> responseType)
payload
, queryName
and expected responseType
.payload
- The payload expressing the queryqueryName
- The name identifying the query to executeresponseType
- The expected response typepublic GenericQueryMessage(Message<T> delegate, String queryName, Class<R> responseType)
delegate
as the carrier of payload and metadata and given
queryName
and expecting the given responseType
.delegate
- The message containing the payload and meta data for this messagequeryName
- The name identifying the query to executeresponseType
- The expected response typepublic String getQueryName()
QueryMessage
getQueryName
in interface QueryMessage<T,R>
public Class<R> getResponseType()
QueryMessage
getResponseType
in interface QueryMessage<T,R>
public QueryMessage<T,R> withMetaData(Map<String,?> metaData)
Message
metaData
. The payload remains unchanged.
While the implementation returned may be different than the implementation of this
, implementations
must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent
errors further downstream.withMetaData
in interface Message<T>
withMetaData
in interface QueryMessage<T,R>
metaData
- The new MetaData for the Messagepublic QueryMessage<T,R> andMetaData(Map<String,?> metaData)
Message
metaData
. The payload
remains unchanged.andMetaData
in interface Message<T>
andMetaData
in interface QueryMessage<T,R>
metaData
- The MetaData to merge withCopyright © 2010–2017. All rights reserved.