by Zelphyr · 12y ago · 0 comments
JWalk.getString(user, "them", "public_keys", "primary", "bundle");
is better than user.them.public_keys.primary.bundle
What am I missing? try {
user.them.public_keys.primary.bundle
} rescue {
OhDamn
}
Less obvious is the potential for multiple targets. JWalk probably doesn't do this, but it could. For more ideas for how this could work take a look athttp://research.microsoft.com/pubs/77415/theessenceofdataacc...
In fact, now that I think about it, I wonder if you can rig up your POJOs as Java 8 Option<> and remove some of the null checking. I'll have to look into that.
As a side note, Ember.js has a nice method for this built in, that works on plain old Javascript objects as well as the heavier Ember ones:
Em.get(obj, 'user.them.public_keys.primary.bundle')