org.dom4j.tree
Class QNameCache

java.lang.Object
  extended byorg.dom4j.tree.QNameCache

public class QNameCache
extends Object

QNameCache caches instances of QName for reuse both across documents and within documents.

< < < < < < < QNameCache.java

Version:
$Revision: 1.16 $ =======, $Revision: 1.16 $ >>>>>>> 1.15
Author:
James Strachan , James Strachan

Field Summary
protected  Map namespaceCache
          Cache of Mapinstances indexed by namespace which contain caches of QNamefor each name
protected  Map noNamespaceCache
          Cache of QNameinstances with no namespace
 
Constructor Summary
QNameCache()
           
QNameCache(DocumentFactory documentFactory)
           
 
Method Summary
protected  Map createMap()
          A factory method
protected  QName createQName(String name)
          Factory method to create a new QName object which can be overloaded to create derived QName instances
protected  QName createQName(String name, Namespace namespace)
          Factory method to create a new QName object which can be overloaded to create derived QName instances
protected  QName createQName(String name, Namespace namespace, String qualifiedName)
          Factory method to create a new QName object which can be overloaded to create derived QName instances
 QName get(String name)
          DOCUMENT ME!
 QName get(String name, Namespace namespace)
          DOCUMENT ME!
 QName get(String localName, Namespace namespace, String qName)
          DOCUMENT ME!
 QName get(String qualifiedName, String uri)
           
protected  Map getNamespaceCache(Namespace namespace)
          DOCUMENT ME!
 List getQNames()
          Returns a list of all the QName instances currently used
 QName intern(QName qname)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noNamespaceCache

protected Map noNamespaceCache
Cache of QNameinstances with no namespace


namespaceCache

protected Map namespaceCache
Cache of Mapinstances indexed by namespace which contain caches of QNamefor each name

Constructor Detail

QNameCache

public QNameCache()

QNameCache

public QNameCache(DocumentFactory documentFactory)
Method Detail

getQNames

public List getQNames()
Returns a list of all the QName instances currently used

Returns:
DOCUMENT ME!

get

public QName get(String name)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
Returns:
the QName for the given name and no namepsace

get

public QName get(String name,
                 Namespace namespace)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
namespace - DOCUMENT ME!
Returns:
the QName for the given local name and namepsace

get

public QName get(String localName,
                 Namespace namespace,
                 String qName)
DOCUMENT ME!

Parameters:
localName - DOCUMENT ME!
namespace - DOCUMENT ME!
qName - DOCUMENT ME!
Returns:
the QName for the given local name, qualified name and namepsace

get

public QName get(String qualifiedName,
                 String uri)

intern

public QName intern(QName qname)
DOCUMENT ME!

Parameters:
qname - DOCUMENT ME!
Returns:
the cached QName instance if there is one or adds the given qname to the cache if not

getNamespaceCache

protected Map getNamespaceCache(Namespace namespace)
DOCUMENT ME!

Parameters:
namespace - DOCUMENT ME!
Returns:
the cache for the given namespace. If one does not currently exist it is created.

createMap

protected Map createMap()
A factory method

Returns:
a newly created Mapinstance.

createQName

protected QName createQName(String name)
Factory method to create a new QName object which can be overloaded to create derived QName instances

Parameters:
name - DOCUMENT ME!
Returns:
DOCUMENT ME!

createQName

protected QName createQName(String name,
                            Namespace namespace)
Factory method to create a new QName object which can be overloaded to create derived QName instances

Parameters:
name - DOCUMENT ME!
namespace - DOCUMENT ME!
Returns:
DOCUMENT ME!

createQName

protected QName createQName(String name,
                            Namespace namespace,
                            String qualifiedName)
Factory method to create a new QName object which can be overloaded to create derived QName instances

Parameters:
name - DOCUMENT ME!
namespace - DOCUMENT ME!
qualifiedName - DOCUMENT ME!
Returns:
DOCUMENT ME!


Copyright © 2001-2005 MetaStuff Ltd.. All Rights Reserved.