From 01edd81b8964e9e1b6f9f392a8e86b201e6a73e6 Mon Sep 17 00:00:00 2001 From: Matthias Ronge Date: Tue, 11 May 2021 15:47:00 +0200 Subject: [PATCH] Improve Javadoc --- .../org/kitodo/filemanagement/FileMapper.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileMapper.java b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileMapper.java index 6190ad4d290..532f47126bb 100644 --- a/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileMapper.java +++ b/Kitodo-FileManagement/src/main/java/org/kitodo/filemanagement/FileMapper.java @@ -17,12 +17,17 @@ import org.kitodo.config.KitodoConfig; /** - * Class for performing mapping and unmapping of URIs. + * Contains functions to turn a relative URI into an absolute one and vice + * versa. + * + *

+ * The name of this class can be misleading: the mapper contains no mapping and + * no entry is added to or removed from a mapping. */ class FileMapper { /** - * Map relative URI to absolute kitodo data directory URI. + * Maps a relative URI an absolute URI below the Kitodo data directory. * * @param uri * relative path @@ -44,6 +49,23 @@ URI unmapUriFromKitodoDataDirectoryUri(URI uri) { return unmapDirectory(uri, KitodoConfig.getKitodoDataDirectory()); } + /** + * Creates a URI relative to {@code directory} if {@code directory} appears + * in the URI string; otherwise the URI is returned unchanged. The relative + * URI is generated by trimming the URI string to the part after + * {@code directory}. + * + *

+ * The name of this method is misleading: there is no mapping stored + * anywhere, and URI is not unregistered from a mapping. Usually such a + * function is called relativize. + * + * @param uri + * absolute path + * @param directory + * Kitodo data directory + * @return relative URI path + */ private URI unmapDirectory(URI uri, String directory) { String path = uri.toString(); directory = encodeDirectory(directory);