public class AnnotationClusterSelector extends AbstractClusterSelector
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
protected Cluster |
doSelectCluster(EventListener eventListener,
Class<?> listenerType)
Select a cluster for the given
eventListener , which has the actual class listenerType . |
selectCluster
public AnnotationClusterSelector(Class<? extends Annotation> annotationType, Cluster cluster)
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)
.annotationType
- The type of annotation to find on the Event Listenerscluster
- The cluster to select if the annotation was foundpublic AnnotationClusterSelector(Class<? extends Annotation> annotationType, Cluster cluster, boolean inspectSuperClasses)
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
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 wellprotected Cluster doSelectCluster(EventListener eventListener, Class<?> listenerType)
AbstractClusterSelector
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
.doSelectCluster
in class AbstractClusterSelector
eventListener
- The listener instance handling the events, possibly a proxylistenerType
- The actual type of the Event ListenerCopyright © 2010-2014. All Rights Reserved.