This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 0b665692dc12b5eba4c9abf0470f22db9149ea32 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Apr 24 14:46:26 2025 +0200 Simplify the default implementation of `getContentPath()`. Add `@since 1.5` Javadoc tag and adjust `{@link}` versus `{@linkplain}`. Minor editions to the Javadoc sentences and a bit of formatting (one sentence per line). --- .../main/org/apache/sis/storage/tiling/Tile.java | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/Tile.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/Tile.java index 0b3f8cdd23..9d7a8dae9c 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/Tile.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/Tile.java @@ -17,7 +17,6 @@ package org.apache.sis.storage.tiling; import java.nio.file.Path; -import java.util.Collection; import java.util.Optional; import org.opengis.metadata.Metadata; import org.apache.sis.coverage.grid.GridExtent; @@ -25,6 +24,7 @@ import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.Resource; +import org.apache.sis.util.privy.CollectionsExt; /** @@ -112,24 +112,19 @@ public interface Tile { Resource getResource() throws DataStoreException; /** - * Returns the tile content as a {@link Path} instance. - * Tiles are usually small chunks of raw data which are forwarded to a displaying - * device or processing unit. - * Unlike the {@linkplain #getResource()} method this method - * should return the unprocessed data quickly. + * Returns a path to the tile content as a file or a <abbr>BLOB</abbr>. + * Tiles are usually small chunks of raw data which are forwarded to a displaying device or processing unit. + * Unlike the {@link #getResource()} method, this method should return the unprocessed data quickly. * - * <p>Default implementation fallback on the {@linkplain #getResource()} method - * and returns the first path from the {@linkplain #getFileSet()} method</p> + * <p>The default implementation fallbacks on the {@link #getResource()} method + * and returns the first path from the {@linkplain Resource#getFileSet() resource fileset}.</p> * - * @return tile content or empty + * @return path to the tile content, or empty if none. * @throws DataStoreException if an error occurred while returning the content. + * + * @since 1.5 */ default Optional<Path> getContentPath() throws DataStoreException { - final Resource resource = getResource(); - final Optional<Resource.FileSet> opt = resource.getFileSet(); - if (opt.isEmpty()) return Optional.empty(); - final Collection<Path> paths = opt.get().getPaths(); - if (paths.isEmpty()) return Optional.empty(); - return Optional.of(paths.iterator().next()); + return getResource().getFileSet().map((fs) -> CollectionsExt.first(fs.getPaths())); } }