/** * Traverse a node and return the result * * <p>Note that this method shortcuts: it stops at the first node it cannot * traverse.</p> * * @param node the node to traverse * @return the resulting node, {@code null} if not found */ public final T get(final T node) { T ret = node; for (final TokenResolver<T> tokenResolver: tokenResolvers) { if (ret == null) break; ret = tokenResolver.get(ret); } return ret; }
/** * Traverse a node and return the result * * <p>Note that this method shortcuts: it stops at the first node it cannot * traverse.</p> * * @param node the node to traverse * @return the resulting node, {@code null} if not found */ public final T get(final T node) { T ret = node; for (final TokenResolver<T> tokenResolver: tokenResolvers) { if (ret == null) break; ret = tokenResolver.get(ret); } return ret; }
/** * Calculate the next URI context from a starting reference and node * * @param startingRef the starting reference * @param ptr the JSON Pointer * @param startingNode the starting node * @return the calculated reference */ private static JsonRef nextRef(final JsonRef startingRef, final JsonPointer ptr, final JsonNode startingNode) { JsonRef ret = startingRef; JsonRef idRef; JsonNode node = startingNode; for (final TokenResolver<JsonNode> resolver: ptr) { node = resolver.get(node); if (node == null) break; idRef = idFromNode(node); if (idRef != null) ret = ret.resolve(idRef); } return ret; }
/** * Calculate the next URI context from a starting reference and node * * @param startingRef the starting reference * @param ptr the JSON Pointer * @param startingNode the starting node * @return the calculated reference */ private static JsonRef nextRef(final JsonRef startingRef, final JsonPointer ptr, final JsonNode startingNode) { JsonRef ret = startingRef; JsonRef idRef; JsonNode node = startingNode; for (final TokenResolver<JsonNode> resolver: ptr) { node = resolver.get(node); if (node == null) break; idRef = idFromNode(node); if (idRef != null) ret = ret.resolve(idRef); } return ret; }
/** * Calculate the next URI context from a starting reference and node * * @param startingRef the starting reference * @param ptr the JSON Pointer * @param startingNode the starting node * @return the calculated reference */ private static JsonRef nextRef(final JsonRef startingRef, final JsonPointer ptr, final JsonNode startingNode) { JsonRef ret = startingRef; JsonRef idRef; JsonNode node = startingNode; for (final TokenResolver<JsonNode> resolver: ptr) { node = resolver.get(node); if (node == null) break; idRef = idFromNode(node); if (idRef != null) ret = ret.resolve(idRef); } return ret; }