public class NamespaceRegistryWithAliases extends Object implements NamespaceRegistry
NamespaceRegistry.Holder, NamespaceRegistry.Namespace| Constructor and Description |
|---|
NamespaceRegistryWithAliases(NamespaceRegistry delegate,
Map<String,String> aliaseNamespaceUriByPrefix,
Map<String,String> namespaceUrisByAliasUri)
Construct a new registry around another delegate registry with a set of aliases for existing namespaces in the delegate
registry.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultNamespaceUri()
Return the namespace URI that is currently mapped to the empty prefix, or null if there is no current default namespace.
|
String |
getNamespaceForPrefix(String prefix)
Get the namespace URI for the supplied prefix.
|
Set<NamespaceRegistry.Namespace> |
getNamespaces()
Obtain a snapshot of all of the
namespaces registered at the time this method is called. |
String |
getPrefixForNamespaceUri(String namespaceUri,
boolean generateIfMissing)
Return the prefix used for the supplied namespace URI.
|
Set<String> |
getRegisteredNamespaceUris()
Obtain the set of namespaces that are registered.
|
boolean |
isRegisteredNamespaceUri(String namespaceUri)
Return whether there is a registered prefix for the supplied namespace URI.
|
void |
register(Iterable<NamespaceRegistry.Namespace> namespaces) |
String |
register(String prefix,
String namespaceUri)
Register a new namespace using the supplied prefix, returning the namespace URI previously registered under that prefix.
|
boolean |
unregister(String namespaceUri)
Unregister the namespace with the supplied URI.
|
public NamespaceRegistryWithAliases(NamespaceRegistry delegate, Map<String,String> aliaseNamespaceUriByPrefix, Map<String,String> namespaceUrisByAliasUri)
aliases and mapping each alias to its existing "real" namespace in namespaceUrisByAliasUridelegate - the actual delegate registry containing the existing (real) namespacesaliaseNamespaceUriByPrefix - the map of alias namespaces keyed by their prefixesnamespaceUrisByAliasUri - the map of existing namespace URIs keyed by the aliasesIllegalArgumentException - if any parameters are null, if there are no aliases, or if the namespaces in the
aliases registry do not correspond exactly to the mappings in namespaceUrisByAliasUripublic String getDefaultNamespaceUri()
NamespaceRegistrygetDefaultNamespaceUri in interface NamespaceRegistrypublic String getNamespaceForPrefix(String prefix)
NamespaceRegistrygetNamespaceForPrefix in interface NamespaceRegistryprefix - the namespace prefixpublic Set<NamespaceRegistry.Namespace> getNamespaces()
NamespaceRegistrynamespaces registered at the time this method is called. The resulting
set is immutable, and will not reflect changes made to the registry.getNamespaces in interface NamespaceRegistryNamespaceRegistry.Namespace objects reflecting a snapshot of the registry; never nullpublic String getPrefixForNamespaceUri(String namespaceUri, boolean generateIfMissing)
NamespaceRegistrygetPrefixForNamespaceUri in interface NamespaceRegistrynamespaceUri - the namespace URIgenerateIfMissing - true if the namespace URI has not already been registered and the method should auto-register the
namespace with a generated prefix, or false if the method should never auto-register the namespacenull if the namespace has not been registered
and generateIfMissing is falseNamespaceRegistry.isRegisteredNamespaceUri(String)public Set<String> getRegisteredNamespaceUris()
NamespaceRegistrygetRegisteredNamespaceUris in interface NamespaceRegistrypublic boolean isRegisteredNamespaceUri(String namespaceUri)
NamespaceRegistryisRegisteredNamespaceUri in interface NamespaceRegistrynamespaceUri - the namespace URIpublic void register(Iterable<NamespaceRegistry.Namespace> namespaces)
register in interface NamespaceRegistrypublic String register(String prefix, String namespaceUri)
NamespaceRegistryregister in interface NamespaceRegistryprefix - the prefix for the namespace, or null if a namesapce prefix should be generated automaticallynamespaceUri - the namespace URIpublic boolean unregister(String namespaceUri)
NamespaceRegistryunregister in interface NamespaceRegistrynamespaceUri - the namespace URICopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.