org.apache.jackrabbit.util.name
Class NamespaceMapping

java.lang.Object
  extended byorg.apache.jackrabbit.name.AbstractNamespaceResolver
      extended byorg.apache.jackrabbit.util.name.NamespaceMapping
All Implemented Interfaces:
NamespaceResolver

public class NamespaceMapping
extends AbstractNamespaceResolver

A Simple Namespace Mapping table. Mappings can be added and then the object can be used as a NamespaceResolver. Additionally, it can be based on a underlying NamespaceResolver


Constructor Summary
NamespaceMapping()
           
NamespaceMapping(NamespaceResolver base)
          Constructor
 
Method Summary
 boolean equals(Object obj)
          Override equals()
 String getPrefix(String uri)
          Returns the prefix which is mapped to the given URI.
 Map getPrefixToURIMapping()
          Return a Map of prefix to URI mappings currently registered.
 String getURI(String prefix)
          Returns the URI to which the given prefix is mapped.
 Map getURIToPrefixMapping()
          Return a Map of URI to prefix mappings currently registered.
 boolean hasPrefix(String prefix)
          Returns true if prefix is already mapped to some URI.
 void setMapping(String prefix, String uri)
          Set a prefix == URI one-to-one mapping
 String toString()
          Override toString()
 
Methods inherited from class org.apache.jackrabbit.name.AbstractNamespaceResolver
addListener, getJCRName, getQName, notifyNamespaceAdded, notifyNamespaceRemapped, removeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamespaceMapping

public NamespaceMapping()

NamespaceMapping

public NamespaceMapping(NamespaceResolver base)
Constructor

Method Detail

getPrefix

public String getPrefix(String uri)
                 throws NamespaceException
Returns the prefix which is mapped to the given URI.

Parameters:
uri - namespace URI
Returns:
the prefix mapped to the given URI.
Throws:
NamespaceException - if the URI is unknown.

getURI

public String getURI(String prefix)
              throws NamespaceException
Returns the URI to which the given prefix is mapped.

Parameters:
prefix - namespace prefix
Returns:
the namespace URI to which the given prefix is mapped.
Throws:
NamespaceException - if the prefix is unknown.

hasPrefix

public boolean hasPrefix(String prefix)
Returns true if prefix is already mapped to some URI. Returns false otherwise.


setMapping

public void setMapping(String prefix,
                       String uri)
                throws NamespaceException
Set a prefix == URI one-to-one mapping

Parameters:
prefix -
uri -
Throws:
NamespaceException

getPrefixToURIMapping

public Map getPrefixToURIMapping()
Return a Map of prefix to URI mappings currently registered. The returned Map is a copy of the internal Map.

Returns:
Map

getURIToPrefixMapping

public Map getURIToPrefixMapping()
Return a Map of URI to prefix mappings currently registered. The returned Map is a copy of the internal Map.

Returns:
Map

equals

public boolean equals(Object obj)
Override equals()

Parameters:
obj -
Returns:
boolean

toString

public String toString()
Override toString()

Returns:
String


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.