Class QNameCache


  • public class QNameCache
    extends java.lang.Object

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

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<Namespace,java.util.Map<java.lang.String,QName>> namespaceCache
      Cache of Mapinstances indexed by namespace which contain caches of QNamefor each name
      protected java.util.Map<java.lang.String,QName> noNamespaceCache
      Cache of QNameinstances with no namespace
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.Map<java.lang.String,QName> createMap()
      A factory method
      protected QName createQName(java.lang.String name)
      Factory method to create a new QName object which can be overloaded to create derived QName instances
      protected QName createQName(java.lang.String name, Namespace namespace)
      Factory method to create a new QName object which can be overloaded to create derived QName instances
      protected QName createQName(java.lang.String name, Namespace namespace, java.lang.String qualifiedName)
      Factory method to create a new QName object which can be overloaded to create derived QName instances
      QName get(java.lang.String name)
      DOCUMENT ME!
      QName get(java.lang.String qualifiedName, java.lang.String uri)  
      QName get(java.lang.String name, Namespace namespace)
      DOCUMENT ME!
      QName get(java.lang.String localName, Namespace namespace, java.lang.String qName)
      DOCUMENT ME!
      protected java.util.Map<java.lang.String,QName> getNamespaceCache(Namespace namespace)
      DOCUMENT ME!
      java.util.List<QName> 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 java.util.Map<java.lang.String,QName> noNamespaceCache
        Cache of QNameinstances with no namespace
      • namespaceCache

        protected java.util.Map<Namespace,java.util.Map<java.lang.String,QName>> namespaceCache
        Cache of Mapinstances indexed by namespace which contain caches of QNamefor each name
    • Constructor Detail

      • QNameCache

        public QNameCache()
    • Method Detail

      • getQNames

        public java.util.List<QName> getQNames()
        Returns a list of all the QName instances currently used
        Returns:
        DOCUMENT ME!
      • get

        public QName get(java.lang.String name)
        DOCUMENT ME!
        Parameters:
        name - DOCUMENT ME!
        Returns:
        the QName for the given name and no namepsace
      • get

        public QName get(java.lang.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(java.lang.String localName,
                         Namespace namespace,
                         java.lang.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(java.lang.String qualifiedName,
                         java.lang.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 java.util.Map<java.lang.String,QName> 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 java.util.Map<java.lang.String,QName> createMap()
        A factory method
        Returns:
        a newly created Mapinstance.
      • createQName

        protected QName createQName(java.lang.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(java.lang.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(java.lang.String name,
                                    Namespace namespace,
                                    java.lang.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!