I have a class whose constructor takes an object containing the parameters for that class (I'm sure there's a pretty name for this, but I don't know it), and I am considering my options for handling validation of the parameters.
Should I do validation in the main class constructor and just let the parameter wrapper class be a dumb container incapable of questioning any values it is given? And if so, is it good practice to throw IllegalArgumentExceptions, even though it is a member of the wrapper class that is "illegal", and not the object itself? Although I guess an object with "illegal" parameters could be viewed as an "illegal object" in it's own right.
The other option seems to be to do some validation in the parameter wrapper class.
I dunno, to me it sounds "cleaner" to just let the main class keep track of what values it accepts, it doesn't sound like the responsibility of the wrapper class? Then again, I could write a new validation class, but that sounds ... unnecessary? Overkill if you will.