Originally posted by Palash Sahu:
Thanks a ton for your reply.
Actualy scenario is number of message processors will be invoked by Message Driven POJO(MDP), a spring's solution.
Originally posted by Stan James:
Can you move the code specific to each subtype into the subtype behind a common method?
Originally posted by Stan James:
Or put the code specific to each subtype into its own Strategy?
Originally posted by Peer Reynders:
This is an indication that your abstraction/interface on A needs some work. In the simplest (but not the best) case you could just promote the B method to the A level and have C do nothing when that method is called. However it is more likely that you need to have a good look at the code that uses instanceof. Some of that code may need to go inside of A as a new suitably named method that makes sense for most, if not all subclasses of A. Then inside of that method, call template methods that the subclass can override - in which case B would put its code there, while C ignores it.