fge/jackson-coreutils — pull request #3 by rwatler (2013-05-17 19:31:31+00:00)
Title: JsonPointer.parent() Convenience Method

Francis:

A handy convenience method for JsonPointer if you agree that it is. Otherwise, I was forced to do something like this externally:

public static JsonPointer parentJsonPointer(JsonPointer pointer) {
List> parentResolvers = new ArrayList>();
Iterator> tokenResolverIter = pointer.iterator();
if (tokenResolverIter.hasNext()) {
for (;;) {
TokenResolver next = tokenResolverIter.next();
if (tokenResolverIter.hasNext()) {
parentResolvers.add(next);
continue;
}
break;
}
}
return new JsonPointer(parentResolvers);
}

Seems like something that others may need as well. Thanks!