Class InstantiatingClassBasedListenerObjectCreator

All Implemented Interfaces:
ListenerObjectCreator

public class InstantiatingClassBasedListenerObjectCreator extends AbstractClassBasedListenerObjectCreator
This ListenerObjectCreator creates ListenerObjects from classes. Users can pass in Classes or packagenames and this class will scan the Classes and create ListenerObjects for the public methods that are annotated with Listener. Note that public methods inherited from superclasses and superinterfaces will also be scanned. This means that users must take care not to scan a method twice, once as a method of a class and once as a method of a superclass, by passing a class/interface and its superclass/superinterface separately to this ListenerObjectCreator.

Please note that in Java, method annotations are NOT inherited. This means that, if you override/implement a method in a subclass or subinterface, and the overriding/implementing method does not have the annotation, then that method will not inherit it. If a class or interface just inherits a method, without overriding it, then the annotation WILL exist.

To get the actual Objects that the listeners run on, this class simply attempts to instantiate an Object for each Class that it scans. When there is no default constructor for a Class, the Class will simply be ignored.

Author:
G.J. Schouten