I can do this in C++ and Python, but I haven’t quite figured it out on java.
My class has a ‘MessageReceived’ function that my network loop executes when a message comes in. I want the user to be able to write a method in their own class that they want to have run by MessageReceived, but I can’t figure out how to pass and execute a method in Java. I can work around it by inheriting the class and overriding MessageReceived, but I’m hoping I can avoid forcing the user to do that.
You’d want the Observer Pattern for allowing other objects to be notified when a message is received.
It’s not clear what you’re really asking or what problems you have. Is it with design, or is it with actually loading the classes written by the user, or dynamically configuration of the user classes, or something else ?