This commit adds the MessageDispatcher class and uses it in NodeProcess. This way the NodeProcess is processed only once and the result is saved in a Map so it can be quickly accessed on each call to processMessage.
Also it adds a check to make sure that there is only one handler for each class of Message.
Related to #49, this makes me wonder if the annotation processor really is a good idea. Maybe the processor could be able to generate a class that would automatically call the correct method without using reflexivity ?
This commit adds the
MessageDispatcher
class and uses it inNodeProcess
. This way theNodeProcess
is processed only once and the result is saved in aMap
so it can be quickly accessed on each call toprocessMessage
. Also it adds a check to make sure that there is only one handler for each class ofMessage
.Related to #49, this makes me wonder if the annotation processor really is a good idea. Maybe the processor could be able to generate a class that would automatically call the correct method without using reflexivity ?