This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This is a simple code where I have to use many of if conditions to determine what if block to invoke ,I want to use visitor pattern here than if blocks, Please gurus write this in visitor pattern, that will help me understand how to use visitor pattern , All the examples for visitor patterns I see in google does not tell me know how to apply in this case , please gurus help me with translate this code to use visitor pattern.
The purpose of the visitor pattern is to separate an algorithm from the object structure it operates on.
It seems to me that is not the pattern you are looking for.
You need a pattern that allows you to simplify your conditional logic and that can be done using the Command_pattern An Example how the Command Pattern can be used to handle Requests can be found on Peter Roses Blog