add helper method for dealing with navigating through legacy java object graphs which might throw NullPointerException
We have the elvis operator for dealing with nulls on an expression
however this doesnt work when you want to do
the code is messy. So a helper method something like
might help - catching NullPointerExceptions along the way for you (with maybe debug logging if you want to search and find them)
foo ?: "default value"
however this doesnt work when you want to do
foo.bar.whatnot
the code is messy. So a helper method something like
orElse(foo.bar.whatnot, "default value")
might help - catching NullPointerExceptions along the way for you (with maybe debug logging if you want to search and find them)
Leave a comment
(In revision:19120cdd3226fdc4cb6600c15ac7fce8625db7dc) added a helper orElse() method re #124
Branch: master
Branch: master