Package org.powertac.util
Class MessageDispatcher
- java.lang.Object
- 
- org.powertac.util.MessageDispatcher
 
- 
 public class MessageDispatcher extends Object Static resource for dispatching messages. Helps avoid visitor or double-dispatch intrusions into domain types.- Author:
- John Collins
 
- 
- 
Constructor SummaryConstructors Constructor Description MessageDispatcher()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static Objectdispatch(Object target, String methodName, Object... args)Dispatches a call to methodName inside target based on the type of message.
 
- 
- 
- 
Method Detail- 
dispatchpublic static Object dispatch(Object target, String methodName, Object... args) Dispatches a call to methodName inside target based on the type of message. Allows polymorphic method dispatch without the use of visitor or double dispatch schemes, which produce nasty couplings with domain types.Note that this scheme finds only exact matches between types of arguments and declared types of formal parameters for declared or inherited methods. So it will not call a method with formal parameter types of (Transaction, List) if the actual arguments are (Transaction, ArrayList). 
 
- 
 
-