Distinguishing for different cases is bad for extensibility. Use the template pattern instead and call a method of the specific implementation instead.