/** * Create a mutable path as a prefix of the given path * * @param x Source path * @param pfix If positive, the new path is a prefix of x containing pfix * elements. If negative, the new path is a prefix of x with last -pfix * elements removed. */ public MutablePath(Path x, int pfix) { setData(new PathRep(x.getData(), pfix)); pathOwned = true; }
/** * Get a reference to the hidden path's actual field. * * This does not guarantee the sub-path exists. * * @param path * @return */ public static Path getFieldForHidden(Path hiddenPath) { return hiddenPath.prefix(-2).mutableCopy().push(hiddenPath.getLast()); }
public Path absolutePath(Path p) { if (contextPath.numSegments() == 0) { return p.immutableCopy(); } else { return new Path(contextPath, p); } }
@Override public Object getIdentity(JsonNode element) { JsonNode[] nodes = new JsonNode[fields.length]; for (int i = 0; i < fields.length; i++) { nodes[i] = JsonDoc.get(element, fields[i]); } return new DefaultIdentity(nodes); } }
/** * Create a mutable path as a prefix of the given path * * @param x Source path * @param pfix If positive, the new path is a prefix of x containing pfix * elements. If negative, the new path is a prefix of x with last -pfix * elements removed. */ public MutablePath(Path x, int pfix) { setData(new PathRep(x.getData(), pfix)); pathOwned = true; }
/** * Create a mutable path as a prefix of the given path * * @param x Source path * @param pfix If positive, the new path is a prefix of x containing pfix * elements. If negative, the new path is a prefix of x with last -pfix * elements removed. */ public MutablePath(Path x, int pfix) { setData(new PathRep(x.getData(), pfix)); pathOwned = true; }