/******************************************************************************************************************* * * Constrains the search to the entity with the given path. * * @param path the path * @return the {@code Finder} * ******************************************************************************************************************/ @Nonnull public default PathAwareFinder withPath (@Nonnull String path) { return withPath(Paths.get(path)); } }
/******************************************************************************************************************* * * @param entity * @param path the path * @return the entity, if present * ******************************************************************************************************************/ @Nonnull private static Optional<PathAwareEntity> childMatchingPath (final @Nonnull PathAwareEntity entity, final @Nonnull Path path) { return ((PathAwareFinder)asSimpleComposite(entity).findChildren()).withPath(path).optionalResult(); }
final Entity entity = contentDirectory.findRoot() .findChildren() .withPath(path) .optionalResult() .orElseThrow(() ->