Class Namespaces

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map

    public class Namespaces
    extends java.util.HashMap

    Description: A HashMap of packageNames and namespaces with some helper methods

    Author:
    rkumar@borland.com
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      Namespaces()
      Constructor Namespaces
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCreate​(java.lang.String key)
      Get the namespaace for the given package If there is no entry in the HashMap for this namespace, create one.
      java.lang.String getCreate​(java.lang.String key, java.lang.String prefix)
      Get the namespaace for the given package If there is no entry in the HashMap for this namespace, create one.
      java.lang.String getCreatePrefix​(java.lang.String namespace)
      Get the prefix for the given namespace.
      java.util.Iterator getNamespaces()
      Get the list of namespaces currently registered
      static java.lang.String getPackage​(java.lang.String namespace)
      Reverse the process.
      static java.lang.String makeNamespace​(java.lang.String clsName)
      Make namespace from a fully qualified class name use the default protocol for the namespace
      static java.lang.String makeNamespace​(java.lang.String clsName, java.lang.String protocol)
      Make namespace from a fully qualified class name and the given protocol
      java.lang.Object put​(java.lang.Object key, java.lang.Object value, java.lang.String prefix)
      adds an entry to the packagename/namespace HashMap.
      void putAll​(java.util.Map map)
      adds an entry to the packagename/namespace HashMap for each of the entry in the map.
      void putAllPrefix​(java.util.Map map)
      adds an entry to the namespace / prefix HashMap for each of the entry in the map.
      void putPrefix​(java.lang.String namespace, java.lang.String prefix)
      put the gine namespace / prefix into the appropriate HashMap
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • Namespaces

        public Namespaces()
        Constructor Namespaces
    • Method Detail

      • getCreate

        public java.lang.String getCreate​(java.lang.String key)
        Get the namespaace for the given package If there is no entry in the HashMap for this namespace, create one.
        Parameters:
        key - String representing packagename
        Returns:
        the namespace either created or existing
      • getCreate

        public java.lang.String getCreate​(java.lang.String key,
                                          java.lang.String prefix)
        Get the namespaace for the given package If there is no entry in the HashMap for this namespace, create one.
        Parameters:
        key - String representing packagename
        prefix - the prefix to use for the generated namespace
        Returns:
        the namespace either created or existing
      • put

        public java.lang.Object put​(java.lang.Object key,
                                    java.lang.Object value,
                                    java.lang.String prefix)
        adds an entry to the packagename/namespace HashMap. In addition, also makes an entry in the auxillary namespace/prefix HashMap if an entry doesn't already exists
        Parameters:
        key - packageName String
        value - namespace value
        prefix - the prefix to use for the given namespace
        Returns:
        old value for the specified key
      • putAll

        public void putAll​(java.util.Map map)
        adds an entry to the packagename/namespace HashMap for each of the entry in the map. In addition, also add an entries in the auxillary namespace/prefix HashMap
        Specified by:
        putAll in interface java.util.Map
        Overrides:
        putAll in class java.util.HashMap
        Parameters:
        map - packageName/namespace map
      • getCreatePrefix

        public java.lang.String getCreatePrefix​(java.lang.String namespace)
        Get the prefix for the given namespace. If one exists, create one
        Parameters:
        namespace - namespace
        Returns:
        prefix String
      • putPrefix

        public void putPrefix​(java.lang.String namespace,
                              java.lang.String prefix)
        put the gine namespace / prefix into the appropriate HashMap
        Parameters:
        namespace -
        prefix -
      • putAllPrefix

        public void putAllPrefix​(java.util.Map map)
        adds an entry to the namespace / prefix HashMap for each of the entry in the map.
        Parameters:
        map - packageName/namespace map
      • makeNamespace

        public static java.lang.String makeNamespace​(java.lang.String clsName)
        Make namespace from a fully qualified class name use the default protocol for the namespace
        Parameters:
        clsName - fully qualified class name
        Returns:
        namespace namespace String
      • makeNamespace

        public static java.lang.String makeNamespace​(java.lang.String clsName,
                                                     java.lang.String protocol)
        Make namespace from a fully qualified class name and the given protocol
        Parameters:
        clsName - fully qualified class name
        protocol - protocol String
        Returns:
        namespace namespace String
      • getPackage

        public static java.lang.String getPackage​(java.lang.String namespace)
        Reverse the process. Get the package name from the namespace.
        Parameters:
        namespace -
        Returns:
      • getNamespaces

        public java.util.Iterator getNamespaces()
        Get the list of namespaces currently registered
        Returns:
        iterator