This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Our current application is exposed to be triggered by external apps. The input for the same being a custom complex java object. We validate this input java object for null checks and empty strings. Now the check happens in a very generic fashion. What we want to develop is a routine something how xml schema validation happens where in the error message back to the invoking application we can give elaborate details which attribute was null or which string attribute was empty. Pardon me if I sound dense. Since the checks we have in java are generic I only manage to return a message back to the calling app like "Invalid input" but what I want to acheive is "String str is empty" or "Object xyz is null" as part of the return error message. I was wondering in the generic check how can we introspect the attribute name. What i eventually want to do is list out all erroneous attributes and list down the error description for each and send them back to the calling app.