org.axonframework.eventhandling
Class AnnotationClusterSelector
java.lang.Object
org.axonframework.eventhandling.AbstractClusterSelector
org.axonframework.eventhandling.AnnotationClusterSelector
- All Implemented Interfaces:
- ClusterSelector
public class AnnotationClusterSelector
- extends AbstractClusterSelector
Cluster Selector implementation that selects a cluster if an Annotation is present on the Event Listener class.
- Since:
- 2.0
- Author:
- Allard Buijze
|
Constructor Summary |
AnnotationClusterSelector(Class<? extends Annotation> annotationType,
Cluster cluster)
Initializes a ClusterSelector instance that selects the given cluster for Event Listeners that are
annotated with the given annotationType. |
AnnotationClusterSelector(Class<? extends Annotation> annotationType,
Cluster cluster,
boolean inspectSuperClasses)
Initializes a ClusterSelector instance that selects the given cluster for Event Listeners that are
annotated with the given annotationType. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationClusterSelector
public AnnotationClusterSelector(Class<? extends Annotation> annotationType,
Cluster cluster)
- Initializes a ClusterSelector instance that selects the given
cluster for Event Listeners that are
annotated with the given annotationType.
Note that this instance will not search superclasses for annotations by default. If annotation on
classes should also reflect on their subclasses, make sure to use the
@Inherited Meta-Annotation, or use AnnotationClusterSelector(Class, Cluster, boolean).
- Parameters:
annotationType - The type of annotation to find on the Event Listenerscluster - The cluster to select if the annotation was found
AnnotationClusterSelector
public AnnotationClusterSelector(Class<? extends Annotation> annotationType,
Cluster cluster,
boolean inspectSuperClasses)
- Initializes a ClusterSelector instance that selects the given
cluster for Event Listeners that are
annotated with the given annotationType. If inspectSuperClasses is true,
super classes will be searched for the annotation, regardless if the annotation is marked as @Inherited
- Parameters:
annotationType - The type of annotation to find on the Event Listenerscluster - The cluster to select if the annotation was foundinspectSuperClasses - Whether or not to inspect super classes as well
doSelectCluster
protected Cluster doSelectCluster(EventListener eventListener,
Class<?> listenerType)
- Description copied from class:
AbstractClusterSelector
- Select a cluster for the given
eventListener, which has the actual class listenerType.
Note that the given listenerType does not have to be assignable to EventListener, as
it is possible that the eventListener acts as a proxy to an instance of listenerType.
- Specified by:
doSelectCluster in class AbstractClusterSelector
- Parameters:
eventListener - The listener instance handling the events, possibly a proxylistenerType - The actual type of the Event Listener
- Returns:
- the cluster to assign the Event Listener to
Copyright © 2010-2016. All Rights Reserved.