Java - Implemented template method and strategy pattern