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,
ResponseType<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,
ResponseType<R> responseType)
Initializes the message with the given
payload and expected responseType . |
GenericQueryMessage(T payload,
String queryName,
ResponseType<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 QueryMessage with its MetaData merged with given
metaData . |
protected void |
describeTo(StringBuilder stringBuilder)
Describe the message specific properties to the given
stringBuilder . |
protected String |
describeType()
Describe the type of message, used in
MessageDecorator.toString() . |
String |
getQueryName()
Returns the name identifying the query to be executed.
|
ResponseType<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 QueryMessage with the given
metaData . |
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdentifier, getMetaData, getPayload, getPayloadType
public GenericQueryMessage(T payload, ResponseType<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 type of type
ResponseType
public GenericQueryMessage(T payload, String queryName, ResponseType<R> responseType)
payload
, queryName
and expected responseType
.payload
- The payload expressing the queryqueryName
- The name identifying the query to executeresponseType
- The expected response type of type
ResponseType
public GenericQueryMessage(Message<T> delegate, String queryName, ResponseType<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 type of type
ResponseType
public String getQueryName()
QueryMessage
getQueryName
in interface QueryMessage<T,R>
public ResponseType<R> getResponseType()
QueryMessage
getResponseType
in interface QueryMessage<T,R>
public QueryMessage<T,R> withMetaData(Map<String,?> metaData)
QueryMessage
metaData
. The payload remains unchanged.withMetaData
in interface Message<T>
withMetaData
in interface QueryMessage<T,R>
metaData
- The new MetaData for the QueryMessagepublic QueryMessage<T,R> andMetaData(Map<String,?> metaData)
QueryMessage
metaData
. The payload
remains unchanged.andMetaData
in interface Message<T>
andMetaData
in interface QueryMessage<T,R>
metaData
- The MetaData to merge into the QueryMessageprotected void describeTo(StringBuilder stringBuilder)
MessageDecorator
stringBuilder
. Subclasses should override this
method, calling the super method and appending their own properties to the end (or beginning).
As convention, String values should be enclosed in single quotes, Objects in curly brackets and numeric values may be appended without enclosing. All properties should be preceded by a comma when appending, or finish with a comma when prefixing values.
describeTo
in class MessageDecorator<T>
stringBuilder
- the builder to append data toprotected String describeType()
MessageDecorator
MessageDecorator.toString()
.
Defaults to the simple class name of the actual instance.
describeType
in class MessageDecorator<T>
Copyright © 2010–2018. All rights reserved.