R
- the type of response this query subscription containspublic class QuerySubscription<R> extends Object
QueryBus
. As such contains the response type of the query handler and the complete
handler itself. The first is typically used by the QueryBus to select the right query handler when a query comes in.
The latter is used to perform the actual query.Constructor and Description |
---|
QuerySubscription(Type responseType,
MessageHandler<? super QueryMessage<?,R>> queryHandler)
|
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(ResponseType<?> queryResponseType)
Check if this
QuerySubscription can handle the given queryResponseType , by calling the ResponseType.matches(Type) function on it and providing the set responseType of this subscription. |
boolean |
equals(Object obj) |
MessageHandler<? super QueryMessage<?,R>> |
getQueryHandler()
Retrieve the query handler of this subscription as a
MessageHandler . |
Type |
getResponseType()
Retrieve the response type of this subscription as a
Type . |
int |
hashCode() |
public QuerySubscription(@Nonnull Type responseType, @Nonnull MessageHandler<? super QueryMessage<?,R>> queryHandler)
responseType
- a Type
as the response type of this subscriptionqueryHandler
- the subscribed MessageHandler
public Type getResponseType()
Type
.Type
tied to this subscriptionpublic boolean canHandle(@Nonnull ResponseType<?> queryResponseType)
QuerySubscription
can handle the given queryResponseType
, by calling the ResponseType.matches(Type)
function on it and providing the set responseType
of this subscription.queryResponseType
- a ResponseType
to match this subscriptions it's responseType
againstqueryResponseType
its ResponseType.matches(Type)
returns true, false if
otherwisepublic MessageHandler<? super QueryMessage<?,R>> getQueryHandler()
MessageHandler
.MessageHandler
tied to this subscriptionCopyright © 2010–2023. All rights reserved.