Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.property.basic
Class LocalNamespaceRegistry

    java.lang.Object
      org.modeshape.graph.property.basic.SimpleNamespaceRegistry
          org.modeshape.graph.property.basic.LocalNamespaceRegistry

All Implemented Interfaces:
  NamespaceRegistry

    @ThreadSafe
    public class LocalNamespaceRegistry

extends SimpleNamespaceRegistry

A special `NamespaceRegistry` implementation that can be used to track transient registrations for another delegate registry.

Nested Class Summary

Nested classes/interfaces inherited from interface org.modeshape.graph.property.NamespaceRegistry
`NamespaceRegistry.Namespace`

Field Summary

Fields inherited from class org.modeshape.graph.property.basic.SimpleNamespaceRegistry
`DEFAULT_NAMESPACE_URI, DEFAULT_PREFIX_NUMBER_FORMAT, DEFAULT_PREFIX_TEMPLATE`

Constructor Summary
`LocalNamespaceRegistry(NamespaceRegistry delegate)`
`LocalNamespaceRegistry(NamespaceRegistry delegate, String defaultNamespaceUri)`

Method Summary
`String` | `getDefaultNamespaceUri()` Return the namespace URI that is currently mapped to the empty prefix, or null if there is no current default namespace.
`NamespaceRegistry` | `getDelegate()`
`Set<NamespaceRegistry.Namespace>` | `getLocalNamespaces()` Obtain the set of namespaces that are overridden within this `LocalNamespaceRegistry` instance.
`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.
`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.

Methods inherited from class org.modeshape.graph.property.basic.SimpleNamespaceRegistry
`generatePrefix, getGeneratedPrefixTemplate, register, setGeneratedPrefixTemplate, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LocalNamespaceRegistry

    public LocalNamespaceRegistry(NamespaceRegistry delegate)

Parameters:
  `delegate` - the namespace registry that this registry should delegate to if not found locally

### LocalNamespaceRegistry

    public LocalNamespaceRegistry(NamespaceRegistry delegate,
                                  String defaultNamespaceUri)

Parameters:
  `delegate` - the namespace registry that this registry should delegate to if not found locally
  `defaultNamespaceUri` - the namespace URI to use for the default prefix

Method Detail

### getDefaultNamespaceUri

    public String getDefaultNamespaceUri()

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

  Specified by:
    `getDefaultNamespaceUri` in interface `NamespaceRegistry`
  Overrides:
    `getDefaultNamespaceUri` in class `SimpleNamespaceRegistry`
  Returns:
    the namespace URI that represents the default namespace, or null if there is no default namespace
  See Also:
    `SimpleNamespaceRegistry.getDefaultNamespaceUri()`

### getNamespaceForPrefix

    public String getNamespaceForPrefix(String prefix)

  Get the namespace URI for the supplied prefix.

  Specified by:
    `getNamespaceForPrefix` in interface `NamespaceRegistry`
  Overrides:
    `getNamespaceForPrefix` in class `SimpleNamespaceRegistry`
  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
  See Also:
    `SimpleNamespaceRegistry.getNamespaceForPrefix(java.lang.String)`

### getNamespaces

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

  Specified by:
    `getNamespaces` in interface `NamespaceRegistry`
  Overrides:
    `getNamespaces` in class `SimpleNamespaceRegistry`
  Returns:
    an immutable set of `NamespaceRegistry.Namespace` objects reflecting a snapshot of the registry; never null
  See Also:
    `SimpleNamespaceRegistry.getNamespaces()`

### getLocalNamespaces

    public Set<NamespaceRegistry.Namespace> getLocalNamespaces()

  Obtain the set of namespaces that are overridden within this `LocalNamespaceRegistry` instance.

  Returns:
    the set of overridden namespace mappings; never null but possibly empty

### getPrefixForNamespaceUri

    public String getPrefixForNamespaceUri(String namespaceUri,
                                           boolean generateIfMissing)

  Return the prefix used for the supplied namespace URI.

  Specified by:
    `getPrefixForNamespaceUri` in interface `NamespaceRegistry`
  Overrides:
    `getPrefixForNamespaceUri` in class `SimpleNamespaceRegistry`
  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`
  See Also:
    `SimpleNamespaceRegistry.getPrefixForNamespaceUri(java.lang.String, boolean)`

### getRegisteredNamespaceUris

    public Set<String> getRegisteredNamespaceUris()

  Obtain the set of namespaces that are registered.

  Specified by:
    `getRegisteredNamespaceUris` in interface `NamespaceRegistry`
  Overrides:
    `getRegisteredNamespaceUris` in class `SimpleNamespaceRegistry`
  Returns:
    the set of
  See Also:
    `SimpleNamespaceRegistry.getRegisteredNamespaceUris()`

### isRegisteredNamespaceUri

    public boolean isRegisteredNamespaceUri(String namespaceUri)

  Return whether there is a registered prefix for the supplied namespace URI.

  Specified by:
    `isRegisteredNamespaceUri` in interface `NamespaceRegistry`
  Overrides:
    `isRegisteredNamespaceUri` in class `SimpleNamespaceRegistry`
  Parameters:
    `namespaceUri` - the namespace URI
  Returns:
    true if the supplied namespace has been registered with a prefix, or false otherwise
  See Also:
    `SimpleNamespaceRegistry.isRegisteredNamespaceUri(java.lang.String)`

### register

    public String register(String prefix,
                           String namespaceUri)

  Register a new namespace using the supplied prefix, returning the namespace URI previously registered under that prefix.

  Specified by:
    `register` in interface `NamespaceRegistry`
  Overrides:
    `register` in class `SimpleNamespaceRegistry`
  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
  See Also:
    `SimpleNamespaceRegistry.register(java.lang.String, java.lang.String)`

### unregister

    public boolean unregister(String namespaceUri)

  Unregister the namespace with the supplied URI.

  Specified by:
    `unregister` in interface `NamespaceRegistry`
  Overrides:
    `unregister` in class `SimpleNamespaceRegistry`
  Parameters:
    `namespaceUri` - the namespace URI
  Returns:
    true if the namespace was removed, or false if the namespace was not registered
  See Also:
    `SimpleNamespaceRegistry.unregister(java.lang.String)`

### getDelegate

    public NamespaceRegistry getDelegate()

  Returns:
    delegate

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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