[
https://issues.apache.org/jira/browse/LANG-790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13222109#comment-13222109
]
Gokul Nanthakumar C commented on LANG-790:
------------------------------------------
Hi Gary, I like JXPath, the issue is
1. we need to build JXPathContext for all the objects we want to navigate, not
sure about the performance cost associated with that as well.
2. the developer should have idea about xpath to use this
3. by default JXPathContext.setLenient is false which will throw exception if
the path is null or wrong
4. default value incase of null can not be specified explicitly, developer has
to write if condition or use default value methods from other apis.
I thought it will be very handy to have this method with default option and
null safe navigation without knowledge of xpath. Please share your view.
> Null safe Navigation in ObjectUtils
> -----------------------------------
>
> Key: LANG-790
> URL: https://issues.apache.org/jira/browse/LANG-790
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Gokul Nanthakumar C
>
> Adding a method for null safe navigation of objects will be very helpful. for
> example a method like
> ObjectUtils.getValue(Object obj, String "path", String defaultValue);
> ex :ObjectUtils.getValue(myObject, "x.y.z", "default");
> it will navigate in the myObject like myObject.getX().getY().getZ(), if any
> thing in the path is null (x,y or z), it will return the default value.
> It will be really useful, it is like null safe navigation in groovy.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira