Class NamespaceCache


  • public class NamespaceCache
    extends java.lang.Object

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

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>>> cache
      Cache of Mapinstances indexed by URI which contain caches of Namespacefor each prefix
      protected static java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>> noPrefixCache
      Cache of Namespaceinstances indexed by URI for default namespaces with no prefixes
    • Constructor Summary

      Constructors 
      Constructor Description
      NamespaceCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Namespace createNamespace(java.lang.String prefix, java.lang.String uri)
      A factory method to create Namespaceinstance
      Namespace get(java.lang.String uri)
      DOCUMENT ME!
      Namespace get(java.lang.String prefix, java.lang.String uri)
      DOCUMENT ME!
      protected java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>> getURICache(java.lang.String uri)
      DOCUMENT ME!
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        protected static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>>> cache
        Cache of Mapinstances indexed by URI which contain caches of Namespacefor each prefix
      • noPrefixCache

        protected static java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>> noPrefixCache
        Cache of Namespaceinstances indexed by URI for default namespaces with no prefixes
    • Constructor Detail

      • NamespaceCache

        public NamespaceCache()
    • Method Detail

      • get

        public Namespace get(java.lang.String prefix,
                             java.lang.String uri)
        DOCUMENT ME!
        Parameters:
        prefix - DOCUMENT ME!
        uri - DOCUMENT ME!
        Returns:
        the namespace for the given prefix and uri
      • get

        public Namespace get(java.lang.String uri)
        DOCUMENT ME!
        Parameters:
        uri - DOCUMENT ME!
        Returns:
        the name model for the given name and namepsace
      • getURICache

        protected java.util.Map<java.lang.String,java.lang.ref.WeakReference<Namespace>> getURICache(java.lang.String uri)
        DOCUMENT ME!
        Parameters:
        uri - DOCUMENT ME!
        Returns:
        the cache for the given namespace URI. If one does not currently exist it is created.
      • createNamespace

        protected Namespace createNamespace(java.lang.String prefix,
                                            java.lang.String uri)
        A factory method to create Namespaceinstance
        Parameters:
        prefix - DOCUMENT ME!
        uri - DOCUMENT ME!
        Returns:
        a newly created Namespaceinstance.