I want to get a property via string like:
PropertyUtils.getNestedProperty(object, propertyName);
For example I have Person object and I want to get the name of the father...
PropertyUtils.getNestedProperty(person, "father.firstName");
Now maybe the person doesn't have a father so the object is null and I get a org.apache.commons.beanutils.NestedNullException.
Is it ok to catch this exception (since it is a runtime exception) or should I first find out if the father is null? Or are there other workarounds?