Open closed principle is the most simple one in the list of software design principles I understand. "Open for extension, close for modification" - the idea seems quite straightforward. When a new message type comes in, you have to change this class again to support the new type. This approach violates the open closed principle. To deal with this, we use the ServiceLocatorFactoryFactoryBean provided by Spring framework to support new validation without changing the existing code. By this approach, your code will look much cleaner and become easier to maintain.