I'm creating a Java desktop application and was wondering how I should deal with validation.
I receive an map with registration information (username, password, ...) in my controller. Now I want to validate the information from the map and display all errors that occur in the validation. So I was thinking of creating a custom class RegistrationValidation in a new package called validation. Then make this class return a List with errors. But I been wondering...
I've always learned that the validation should be done in the correct model class, is making a Validation class against the MVC principle?
Where should I call this validation class, from my controller or from my model?
How should I call the validation class? (make the methods static, make it a singleton, just make an instance of it in the controller/model or other?)
Are there any better solutions to extract validation?