I want to validate a Java class object to check if the members obey certain rules. Except for specific rules, I also want to check if there are any string members which are null/empty.
What is a good way of doing so (Validating the string members)?
My approach is:
if(StringUtils.isNotEmpty(sMember1) && StringUtils.isNotEmpty(sMember2)...)
Is there a concise approach of validating all members which are Strings?
(Is Reflection a possibility? If yes, will it be an expensive operation?)