Skip to content

Commit

Permalink
clarify javadoc of NamespaceResolver.getPrefix() to make it clear that
Browse files Browse the repository at this point in the history
this is supposed to resolve the empty prefix as well

In addition clarify that returning null is not allowed.
  • Loading branch information
kwin committed Feb 13, 2020
1 parent 46a2e50 commit cee8641
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class NameParser {
* @param jcrName the name to be parsed. The jcrName may either be in the
* qualified or in the expanded form.
* @param resolver <code>NamespaceResolver</code> use to retrieve the
* namespace URI from the prefix contained in the given JCR name.
* namespace URI from the prefix contained in the given JCR name. Must resolve the empty prefix "" as well.
* @return qName the new <code>Name</code>
* @throws IllegalNameException If <code>jcrName</code> is not a valid
* JCR-style name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import javax.jcr.NamespaceException;

import org.apache.jackrabbit.spi.commons.conversion.NameParser;

/**
* Interface for resolving namespace URIs and prefixes. Unlike the JCR
* {@link javax.jcr.NamespaceRegistry} interface, this interface contains
Expand All @@ -30,9 +32,10 @@ public interface NamespaceResolver {

/**
* Returns the URI to which the given prefix is mapped.
* For the empty prefix the default namespace should be returned as the {@link NameParser} relies on that.
*
* @param prefix namespace prefix
* @return the namespace URI to which the given prefix is mapped.
* @return the namespace URI to which the given prefix is mapped (never {@code null})
* @throws NamespaceException if the prefix is unknown.
*/
String getURI(String prefix) throws NamespaceException;
Expand All @@ -41,7 +44,7 @@ public interface NamespaceResolver {
* Returns the prefix which is mapped to the given URI.
*
* @param uri namespace URI
* @return the prefix mapped to the given URI.
* @return the prefix mapped to the given URI (never {@code null})
* @throws NamespaceException if the URI is unknown.
*/
String getPrefix(String uri) throws NamespaceException;
Expand Down

0 comments on commit cee8641

Please sign in to comment.