org.dom4j.tree
Class NamespaceCache

java.lang.Object
  |
  +--org.dom4j.tree.NamespaceCache

public class NamespaceCache
extends Object

NamespaceCache caches instances of DefaultNamespace for reuse both across documents and within documents.

Version:
$Revision: 1.8 $
Author:
James Strachan

Field Summary
protected static Map cache
          Cache of Map instances indexed by URI which contain caches of Namespace for each prefix
protected static Map noPrefixCache
          Cache of Namespace instances indexed by URI for default namespaces with no prefixes
 
Constructor Summary
NamespaceCache()
           
 
Method Summary
protected  Namespace createNamespace(String prefix, String uri)
          A factory method to create Namespace instance
protected  Map createPrefixMap()
          A factory method to create prefix caches
protected  Map createURIMap()
          A factory method to create URI caches
 Namespace get(String uri)
           
 Namespace get(String prefix, String uri)
           
protected  Map getURICache(String uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected static Map cache
Cache of Map instances indexed by URI which contain caches of Namespace for each prefix


noPrefixCache

protected static Map noPrefixCache
Cache of Namespace instances indexed by URI for default namespaces with no prefixes

Constructor Detail

NamespaceCache

public NamespaceCache()
Method Detail

get

public Namespace get(String prefix,
                     String uri)
Returns:
the name model for the given name and namepsace

get

public Namespace get(String uri)
Returns:
the name model for the given name and namepsace

getURICache

protected Map getURICache(String uri)
Returns:
the cache for the given namespace URI. If one does not currently exist it is created.

createNamespace

protected Namespace createNamespace(String prefix,
                                    String uri)
A factory method to create Namespace instance

Returns:
a newly created Namespace instance.

createPrefixMap

protected Map createPrefixMap()
A factory method to create prefix caches

Returns:
a newly created Map instance.

createURIMap

protected Map createURIMap()
A factory method to create URI caches

Returns:
a newly created Map instance.


Copyright © 2002-2003 MetaStuff Ltd.. All Rights Reserved.