org.modeshape.jcr.value

## Interface NamespaceRegistry

- All Known Implementing Classes:
    LocalNamespaceRegistry, NamespaceRegistryWithAliases, SimpleNamespaceRegistry, SystemNamespaceRegistry, ThreadSafeNamespaceRegistry

      @ThreadSafe
      public interface NamespaceRegistry

  Registry of namespaces, which are used to provide isolated and independent domains for `names`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `NamespaceRegistry.Holder`
    `static interface` | `NamespaceRegistry.Namespace` Representation of a single namespace at a single point in time.

  - ### Method Summary

    Methods
    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.

- - ### Method Detail

    - #### getDefaultNamespaceUri

          String getDefaultNamespaceUri()

      Return the namespace URI that is currently mapped to the empty prefix, or null if there is no current default namespace.
      Returns:
        the namespace URI that represents the default namespace, or null if there is no default namespace

    - #### getNamespaceForPrefix

          String getNamespaceForPrefix(String prefix)

      Get the namespace URI for the supplied prefix.
      Parameters:
        `prefix` - the namespace prefix
      Returns:
        the namespace URI for the supplied prefix, or null if there is no namespace currently registered to use that prefix
      Throws:
        `IllegalArgumentException` - if the prefix is null

    - #### getPrefixForNamespaceUri

          String getPrefixForNamespaceUri(String namespaceUri,
                                        boolean generateIfMissing)

      Return the prefix used for the supplied namespace URI.
      Parameters:
        `namespaceUri` - the namespace URI
        `generateIfMissing` - 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 namespace
      Returns:
        the prefix currently being used for the namespace, or `null` if the namespace has not been registered and `generateIfMissing` is `false`
      Throws:
        `IllegalArgumentException` - if the namespace URI is null
      See Also:
        `isRegisteredNamespaceUri(String)`

    - #### isRegisteredNamespaceUri

          boolean isRegisteredNamespaceUri(String namespaceUri)

      Return whether there is a registered prefix for the supplied namespace URI.
      Parameters:
        `namespaceUri` - the namespace URI
      Returns:
        true if the supplied namespace has been registered with a prefix, or false otherwise
      Throws:
        `IllegalArgumentException` - if the namespace URI is null

    - #### register

          String register(String prefix,
                        String namespaceUri)

      Register a new namespace using the supplied prefix, returning the namespace URI previously registered under that prefix.
      Parameters:
        `prefix` - the prefix for the namespace, or null if a namesapce prefix should be generated automatically
        `namespaceUri` - the namespace URI
      Returns:
        the namespace URI that was previously registered with the supplied prefix, or null if the prefix was not previously bound to a namespace URI
      Throws:
        `IllegalArgumentException` - if the namespace URI is null

    - #### register

          void register(Iterable<NamespaceRegistry.Namespace> namespaces)

    - #### unregister

          boolean unregister(String namespaceUri)

      Unregister the namespace with the supplied URI.
      Parameters:
        `namespaceUri` - the namespace URI
      Returns:
        true if the namespace was removed, or false if the namespace was not registered
      Throws:
        `IllegalArgumentException` - if the namespace URI is null
        `NamespaceException` - if there is a problem unregistering the namespace

    - #### getRegisteredNamespaceUris

          Set<String> getRegisteredNamespaceUris()

      Obtain the set of namespaces that are registered.
      Returns:
        the set of

    - #### getNamespaces

          Set<NamespaceRegistry.Namespace> getNamespaces()

      Obtain a snapshot of all of the `namespaces` registered at the time this method is called. The resulting set is immutable, and will not reflect changes made to the registry.
      Returns:
        an immutable set of `NamespaceRegistry.Namespace` objects reflecting a snapshot of the registry; never null

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.