Your class needs a mechanism for dispatching events to listeners.
Create an instance of EventDispatcherFactory parameterized with your Event interface:
package curam.mypackage;
import com.google.inject.Inject;
import curam.util.persistence.helper.EventDispatcherFactory;
public class MyEventSource {
public abstract class Event {
public void preDoSomething(MyEventSource raiser) {
// intentionally empty
}
public void postDoSomething(MyEventSource raiser) {
// intentionally empty
}
}
@Inject
private EventDispatcherFactory<Event> dispatcher;
public void doSomething() {
// do whatever it is that needs to be done
System.out.println("Do something!");
}
}