Top Description Fields Constructors Methods
org.dom4j.tree

public Class NamespaceCache

extends Object
Class Inheritance
Imports
org.dom4j.Namespace, java.lang.ref.WeakReference, java.util.Map, java.util.concurrent.ConcurrentHashMap

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

Authors
James Strachan , Maarten Coene, Brett Finnell
Version
$Revision: 1.15 $

Field Summary

Modifier and TypeField and Description
protected static Map<String, Map<String, WeakReference<Namespace>>>
cache

Cache of Mapinstances indexed by URI which contain caches of Namespacefor each prefix

protected static Map<String, WeakReference<Namespace>>
noPrefixCache

Cache of Namespaceinstances indexed by URI for default namespaces with no prefixes

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Namespace

Returns:

a newly created Namespaceinstance.
createNamespace
(String
DOCUMENT ME!
prefix
,
String
DOCUMENT ME!
uri
)

A factory method to create Namespaceinstance

public Namespace

Returns:

the namespace for the given prefix and uri
get
(String
DOCUMENT ME!
prefix
,
String
DOCUMENT ME!
uri
)

DOCUMENT ME!

public Namespace

Returns:

the name model for the given name and namepsace
get
(String
DOCUMENT ME!
uri
)

DOCUMENT ME!

protected Map<String, WeakReference<Namespace>>

Returns:

the cache for the given namespace URI. If one does not currently exist it is created.
getURICache
(String
DOCUMENT ME!
uri
)

DOCUMENT ME!

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
protected static Map<String, Map<String, WeakReference<Namespace>>> cache

Cache of Mapinstances indexed by URI which contain caches of Namespacefor each prefix

noPrefixCacheback to summary
protected static Map<String, WeakReference<Namespace>> noPrefixCache

Cache of Namespaceinstances indexed by URI for default namespaces with no prefixes

Constructor Detail

NamespaceCacheback to summary
public NamespaceCache()

Method Detail

createNamespaceback to summary
protected Namespace createNamespace(String prefix, String uri)

A factory method to create Namespaceinstance

Parameters
prefix:String

DOCUMENT ME!

uri:String

DOCUMENT ME!

Returns:Namespace

a newly created Namespaceinstance.

getback to summary
public Namespace get(String prefix, String uri)

DOCUMENT ME!

Parameters
prefix:String

DOCUMENT ME!

uri:String

DOCUMENT ME!

Returns:Namespace

the namespace for the given prefix and uri

getback to summary
public Namespace get(String uri)

DOCUMENT ME!

Parameters
uri:String

DOCUMENT ME!

Returns:Namespace

the name model for the given name and namepsace

getURICacheback to summary
protected Map<String, WeakReference<Namespace>> getURICache(String uri)

DOCUMENT ME!

Parameters
uri:String

DOCUMENT ME!

Returns:Map<String, WeakReference<Namespace>>

the cache for the given namespace URI. If one does not currently exist it is created.