/** * Find all objects that are reachable from the given starting object set through the specified {@link ReferencePath}. * * @param path reference path * @param startObjects starting objects * @return read-only set of objects reachable from {@code startObjects} via {@code path} * @throws UnknownFieldException if {@code path} contains an unknown field * @throws IllegalArgumentException if either parameter is null * @see ReferencePath */ public NavigableSet<JObject> followReferencePath(ReferencePath path, Iterable<? extends JObject> startObjects) { Preconditions.checkArgument(path != null, "null path"); Preconditions.checkArgument(startObjects != null, "null startObjects"); final NavigableSet<ObjId> ids = this.tx.followReferencePath(Iterables.transform(startObjects, this.referenceConverter), path.getReferenceFields(), path.getPathKeyRanges()); return new ConvertedNavigableSet<JObject, ObjId>(ids, this.referenceConverter); }
/** * Find all objects that refer to any object in the given target set through the specified {@link ReferencePath}. * * @param path reference path * @param targetObjects target objects * @return read-only set of objects that refer to any of the {@code targetObjects} via {@code path} * @throws UnknownFieldException if {@code path} contains an unknown field * @throws IllegalArgumentException if either parameter is null * @see ReferencePath */ public NavigableSet<JObject> invertReferencePath(ReferencePath path, Iterable<? extends JObject> targetObjects) { Preconditions.checkArgument(path != null, "null path"); Preconditions.checkArgument(targetObjects != null, "null targetObjects"); final NavigableSet<ObjId> ids = this.tx.invertReferencePath(path.getReferenceFields(), path.getPathKeyRanges(), Iterables.transform(targetObjects, this.referenceConverter)); return new ConvertedNavigableSet<JObject, ObjId>(ids, this.referenceConverter); }