public class AnnotationQueryHandlerAdapter<T> extends Object implements QueryHandlerAdapter, MessageHandler<QueryMessage<?,?>>
@QueryHandler annotated bean into a MessageHandler implementation. Each annotated method is subscribed
as a QueryHandler at the QueryBus for the query type specified by the parameter/return type of that method.| Constructor and Description |
|---|
AnnotationQueryHandlerAdapter(T target)
Initializes the adapter, forwarding call to the given
target. |
AnnotationQueryHandlerAdapter(T target,
ParameterResolverFactory parameterResolverFactory)
Initializes the adapter, forwarding call to the given
target, resolving parameters using the given
parameterResolverFactory. |
AnnotationQueryHandlerAdapter(T target,
ParameterResolverFactory parameterResolverFactory,
HandlerDefinition handlerDefinition)
Initializes the adapter, forwarding call to the given
target, resolving parameters using the given
parameterResolverFactory and creating handlers using handlerDefinition. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(QueryMessage<?,?> message)
Indicates whether this handler can handle the given message
|
Object |
handle(QueryMessage<?,?> message)
Handles the given
message. |
Registration |
subscribe(QueryBus queryBus)
Subscribes query handlers to the given query bus
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTargetTypepublic AnnotationQueryHandlerAdapter(T target)
target.target - The instance with QueryHandler annotated methodspublic AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory)
target, resolving parameters using the given
parameterResolverFactory.target - The instance with QueryHandler annotated methodsparameterResolverFactory - The parameter resolver factory to resolve handler parameters withpublic AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition)
target, resolving parameters using the given
parameterResolverFactory and creating handlers using handlerDefinition.target - The instance with QueryHandler annotated methodsparameterResolverFactory - The parameter resolver factory to resolve handler parameters withhandlerDefinition - The handler definition used to create concrete handlerspublic Registration subscribe(QueryBus queryBus)
QueryHandlerAdaptersubscribe in interface QueryHandlerAdapterqueryBus - the query buspublic Object handle(QueryMessage<?,?> message) throws Exception
MessageHandlermessage.handle in interface MessageHandler<QueryMessage<?,?>>message - The message to be processed.Exception - any exception that occurs during message handlingpublic boolean canHandle(QueryMessage<?,?> message)
MessageHandlercanHandle in interface MessageHandler<QueryMessage<?,?>>message - The message to verifytrue if this handler can handle the message, otherwise falseCopyright © 2010–2018. All rights reserved.