You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2022/01/17 10:26:33 UTC

[GitHub] [sling-org-apache-sling-api] bdelacretaz commented on a change in pull request #40: SLING-11067 extend URIProvider by method returning Optional

bdelacretaz commented on a change in pull request #40:
URL: https://github.com/apache/sling-org-apache-sling-api/pull/40#discussion_r785825886



##########
File path: src/main/java/org/apache/sling/api/resource/external/URIProvider.java
##########
@@ -91,4 +85,34 @@
          */
         PUBLIC
     }
+
+    /**
+     * Return a URI applicable to the defined scope.
+     * @param resource the resource to convert from.
+     * @param scope the required scope.
+     * @param operation the required operation.
+     * @return a URI if the resource has a URI suitable for the requested scope and operation, otherwise the implementation should throw an {@link IllegalArgumentException}.
+     * @throws IllegalArgumentException if a URI for the requested scope and operation cannot be provided to the caller.
+     * @deprecated Use {@link #getOptionalUriForResource(Resource, Scope, Operation)} instead.
+     */
+    @Deprecated
+    @NotNull URI toURI(@NotNull Resource resource, @NotNull Scope scope, @NotNull Operation operation);
+
+    /**
+     * Return a URI applicable to the defined scope.
+     * @param resource the resource to convert from.
+     * @param scope the required scope.
+     * @param operation the required operation.
+     * @return a URI if the resource has a URI suitable for the requested scope and operation, otherwise {@link Optional#empty()}.
+     * @since 1.1.0 (Sling API Bundle 2.25.0)
+     */
+    default @NotNull Optional<URI> getOptionalUriForResource(@NotNull Resource resource, @NotNull Scope scope, @NotNull Operation operation) {

Review comment:
       Unless there's a good reason to use a different name I think this should be called `toOptionalURI` based on the original `toURI` name.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org