The pattern you might be looking for is often called a double control room or sometimes a visitor pattern. http://en.wikipedia.org/wiki/Visitor_pattern
Create a set of classes for events and a set for types of objects. Create interface
public interface VisitEvent { public void visit(EventA eventA); public void visit(EventB eventB);
In an event class, you must invoke a template to visit the class of the object class.
public class EventA { public void visit(ObjectTypeParent otp) { otp.visit(this); } }
Assuming object type classes are inherited from a common class
public abstract class ObjectTypeParent implements VisitEvent { public void visit(EventA eventA) {
then
public class ObjectType01 extends ObjectTypeParent { public void visit(EventA eventA) {
source share