In my current app which is invoked by an external application the interface is a single method with a custom java object as its method parameter.
The first step in the implemenation code is to validate this custom java input object.
The custom object comprises of lot many attributes so accordingly our code looks something like this
In all cases of input validation failure we are passing a generic message back to the external app like "Input validation failed". We want to send back a message something like "attrib 1 cannot be blank" or "attrib2 cannot be null" type of message.
How can I implement such a check in a generic fashion applicable to all attributes and not doing it per attribute basis.