Klasse QualifiedNameMap<T>

java.lang.Object
org.apache.torque.generator.qname.QualifiedNameMap<T>
Typparameter:
T - The class of the object which should be stored in the map.
Alle implementierten Schnittstellen:
Serializable, Map<QualifiedName,T>

public class QualifiedNameMap<T> extends Object implements Map<QualifiedName,T>, Serializable
A special map with a QualifiedName as a key. This map acts as a normal map, except that it has an additional method, getInNamespace(), which respects the visibility rules in the namespace hierarchy. Null cannot be stored as a key for this map.
Siehe auch:
  • Konstruktordetails

    • QualifiedNameMap

      public QualifiedNameMap()
      Constructs an empty QualifiedNameMap.
    • QualifiedNameMap

      public QualifiedNameMap(Map<? extends QualifiedName,? extends T> map)
      Constructs a shallow copy of the supplied map.
      Parameter:
      map - the map to copy, not null.
  • Methodendetails

    • getInHierarchy

      public T getInHierarchy(QualifiedName key)
      Returns the most specific entry in the map which is visible for the provided key. I.e. not only the namespace of the provided QualifiedName is searched, but also all the parent namespaces of the provided QualifiedName. Note that if the most specific matching key is mapped to null, then null is returned, even if another less specific entry exists which is not mapped to null. If only exact matches for the QualifiedName should be returned, use the get(Object) method.
      Parameter:
      key - the qualified name for which the entries in the map should be searched, not null.
      Gibt zurück:
      The entry which is visible to the supplied QualifiedName, or null if no such entry exists. If more such entries exist, the most specific one (i.e. the one with the longest namespace) is returned.
      Löst aus:
      NullPointerException - if key is null.
      Siehe auch:
    • getKeyInHierarchy

      public QualifiedName getKeyInHierarchy(QualifiedName key)
      Returns the most specific key in the map which is visible for the provided key. I.e. not only the namespace of the provided QualifiedName is searched, but also all the parent namespaces of the provided QualifiedName. If no such key exists, null is returned.
      Parameter:
      key - the qualified name for which the entries in the map should be searched, not null.
      Gibt zurück:
      The key which is visible to the supplied QualifiedName, or null if no such key exists. If more such keys exist, the most specific one (i.e. the one with the longest namespace) is returned.
      Löst aus:
      NullPointerException - if key is null.
    • getAllInHierarchy

      public QualifiedNameMap<T> getAllInHierarchy(Namespace namespace)
      Returns all mappings which live in the given namespace. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, both mappings are present in the returned map. For example, if the map contains mappings for org.apache.torque:name1, org.apache:name1, org.apache.torque:name2 and org.apache.torque.generator:name1, and the queried namespace is org.apache.torque, then the mappings for org.apache.torque:name1 and org.apache.torque:name2 and org.apache:name1 are returned. The mapping for org.apache.torque.generator:name1 is not returned, because it is not in the target namespace.
      Parameter:
      namespace - the namespace in which the desired objects should be visible.
      Gibt zurück:
      all mappings in the desired Namespace, not null.
    • getInHierarchy

      public QualifiedNameMap<T> getInHierarchy(Namespace namespace)
      Returns all mappings which live in the given namespace. If one mapping hides another mapping, i.e. if one mapping is a more specialized version of another, the hidden mapping is NOT returned. For example, if the map contains mappings for org.apache.torque:name1, org.apache:name1, org.apache.torque:name2 and org.apache.torque.generator:name1, and the queried namespace is org.apache.torque, then the mappings for org.apache.torque:name1 and org.apache.torque:name2 are returned. The mapping for org.apache:name1 is hidden by org.apache.torque:name1, and org.apache.torque.generator:name1 is not in the target namespace.
      Parameter:
      namespace - the namespace in which the desired objects should be visible.
      Gibt zurück:
      all mappings in the desired Namespace, except the mappings which are hidden by another mapping, not null.
    • get

      public T get(Object key)
      Returns the object which is mapped to the given key. Only Objects of class Namespace are used as keys in this map.
      Angegeben von:
      get in Schnittstelle Map<QualifiedName,T>
      Parameter:
      key - the key for which the mapped object should be returned.
      Gibt zurück:
      the object mapped to the given key, or null if no mapping exists for the key or null is mapped to the key.
      Siehe auch:
    • put

      public T put(QualifiedName key, T value)
      Creates or overwrites a mapping in the map. Null as key is not supported.
      Angegeben von:
      put in Schnittstelle Map<QualifiedName,T>
      Parameter:
      key - the key for the mapping, not null.
      value - the object mapped to the key.
      Gibt zurück:
      the previous object which was mapped to the given key, or null if no mapping existed for the given key.
      Siehe auch:
    • putAll

      public void putAll(Map<? extends QualifiedName,? extends T> toPut)
      Creates or overrides mappings for all the mappings in the supplied map. The supplied map must not contain a mapping for the key null.
      Angegeben von:
      putAll in Schnittstelle Map<QualifiedName,T>
      Parameter:
      toPut - the Map whcih mappings should be added to this map, not null.
      Löst aus:
      NullPointerException - if toPut is null.
      IllegalArgumentException - if toPut contains a mapping for the key null.
      Siehe auch:
    • remove

      public T remove(Object key)
      Removes the mapping for the supplied key, if this mapping exists.
      Angegeben von:
      remove in Schnittstelle Map<QualifiedName,T>
      Parameter:
      key - the key for which the mapping should be removed.
      Gibt zurück:
      the object which was previously mapped to the key, or null if no mapping existed for the provided key.
      Siehe auch:
    • clear

      public void clear()
      Removes all mappings from this map.
      Angegeben von:
      clear in Schnittstelle Map<QualifiedName,T>
      Siehe auch:
    • containsKey

      public boolean containsKey(Object key)
      Returns if this Map contains a mapping for the given key.
      Angegeben von:
      containsKey in Schnittstelle Map<QualifiedName,T>
      Parameter:
      key - the key for which the existence of a mapping should be checked.
      Gibt zurück:
      true if the map contains a mapping for the given key, false otherwise.
      Siehe auch:
    • entrySet

      public Set<Map.Entry<QualifiedName,T>> entrySet()
      Returns all Entries in this map.
      Angegeben von:
      entrySet in Schnittstelle Map<QualifiedName,T>
      Gibt zurück:
      a Set containing all mappings in this map.
      Siehe auch:
    • containsValue

      public boolean containsValue(Object value)
      Checks if any key is mapped to the given value.
      Angegeben von:
      containsValue in Schnittstelle Map<QualifiedName,T>
      Parameter:
      value - the value which existence should be checked in the map.
      Gibt zurück:
      true if any key is mapped to the given value, false otherwise.
      Siehe auch:
    • values

      public Collection<T> values()
      Returns all values in this map.
      Angegeben von:
      values in Schnittstelle Map<QualifiedName,T>
      Gibt zurück:
      a collection containing all values in this map.
      Siehe auch:
    • size

      public int size()
      Counts all mappings in the map.
      Angegeben von:
      size in Schnittstelle Map<QualifiedName,T>
      Gibt zurück:
      the number of mappings in the map.
      Siehe auch:
    • isEmpty

      public boolean isEmpty()
      Returns if the map contains any mappings at all.
      Angegeben von:
      isEmpty in Schnittstelle Map<QualifiedName,T>
      Gibt zurück:
      true if the map contains mappings, false otherwise.
      Siehe auch:
    • keySet

      public Set<QualifiedName> keySet()
      Returns all keys of the map.
      Angegeben von:
      keySet in Schnittstelle Map<QualifiedName,T>
      Gibt zurück:
      a Collection containing all keys of the map, never null.
      Siehe auch:
    • getMoreSpecific

      public T getMoreSpecific(T object1, QualifiedName qualifiedName1, T object2, QualifiedName qualifiedName2)
      Returns the more specific object out of two objects (the object which hides the other object). If one of the two objects is null, the other is returned. If both objects is null, null is returned. If both objects are in the same namespace, object1 is returned. It is assumed that namespace1 is an ancestor namespace of namespace2 or that namespace2 is in an ancestor namespace of namespace1 or both namespaces are the same.
      Parameter:
      object1 - the first object to compare.
      qualifiedName1 - the qualified name of the first object, must not be null if object1 is not null.
      object2 - the second object to compare.
      qualifiedName2 - the namepsace of the second object, must not be null, if object2 is not null.
      Gibt zurück:
      the more specific object, or null if both object1 and object2 are null.
      Löst aus:
      NullPointerException - if object1 and object2 are not null and namespace1 or namespace2 are null.
    • equals

      public boolean equals(Object object)
      Checks if this QualifiedNameMap is equal to another object. This is true if and only if the other object is a QualifiedNameMap, and contains the same mappings as this QualifiedNameMap.
      Angegeben von:
      equals in Schnittstelle Map<QualifiedName,T>
      Setzt außer Kraft:
      equals in Klasse Object
      Parameter:
      object - the object to check whether it is equal to this object.
      Gibt zurück:
      true if this QualifiedNameMap is equal to the object, false otherwise.
    • hashCode

      public int hashCode()
      Returns a hashCode for this object. The returned hashCode is consistent with equals().
      Angegeben von:
      hashCode in Schnittstelle Map<QualifiedName,T>
      Setzt außer Kraft:
      hashCode in Klasse Object
      Gibt zurück:
      a hashcode for this QualifiedNameMap.
    • toString

      public String toString()
      Returns a string representation of this map for debugging purposes.
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      a string representation of this map, not null.