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>
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:
-
Verschachtelte Klassen - Übersicht
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungConstructs an empty QualifiedNameMap.QualifiedNameMap
(Map<? extends QualifiedName, ? extends T> map) Constructs a shallow copy of the supplied map. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
clear()
Removes all mappings from this map.boolean
containsKey
(Object key) Returns if this Map contains a mapping for the given key.boolean
containsValue
(Object value) Checks if any key is mapped to the given value.entrySet()
Returns all Entries in this map.boolean
Checks if this QualifiedNameMap is equal to another object.Returns the object which is mapped to the given key.getAllInHierarchy
(Namespace namespace) Returns all mappings which live in the given namespace.getInHierarchy
(Namespace namespace) Returns all mappings which live in the given namespace.Returns the most specific entry in the map which is visible for the provided key.Returns the most specific key in the map which is visible for the provided key.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).int
hashCode()
Returns a hashCode for this object.boolean
isEmpty()
Returns if the map contains any mappings at all.keySet()
Returns all keys of the map.put
(QualifiedName key, T value) Creates or overwrites a mapping in the map.void
putAll
(Map<? extends QualifiedName, ? extends T> toPut) Creates or overrides mappings for all the mappings in the supplied map.Removes the mapping for the supplied key, if this mapping exists.int
size()
Counts all mappings in the map.toString()
Returns a string representation of this map for debugging purposes.values()
Returns all values in this map.Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Konstruktordetails
-
QualifiedNameMap
public QualifiedNameMap()Constructs an empty QualifiedNameMap. -
QualifiedNameMap
Constructs a shallow copy of the supplied map.- Parameter:
map
- the map to copy, not null.
-
-
Methodendetails
-
getInHierarchy
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 theget(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
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
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
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
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 SchnittstelleMap<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
Creates or overwrites a mapping in the map. Null as key is not supported.- Angegeben von:
put
in SchnittstelleMap<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
Creates or overrides mappings for all the mappings in the supplied map. The supplied map must not contain a mapping for the keynull
.- Angegeben von:
putAll
in SchnittstelleMap<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 keynull
.- Siehe auch:
-
remove
Removes the mapping for the supplied key, if this mapping exists.- Angegeben von:
remove
in SchnittstelleMap<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 SchnittstelleMap<QualifiedName,
T> - Siehe auch:
-
containsKey
Returns if this Map contains a mapping for the given key.- Angegeben von:
containsKey
in SchnittstelleMap<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
Returns all Entries in this map.- Angegeben von:
entrySet
in SchnittstelleMap<QualifiedName,
T> - Gibt zurück:
- a Set containing all mappings in this map.
- Siehe auch:
-
containsValue
Checks if any key is mapped to the given value.- Angegeben von:
containsValue
in SchnittstelleMap<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
Returns all values in this map.- Angegeben von:
values
in SchnittstelleMap<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 SchnittstelleMap<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 SchnittstelleMap<QualifiedName,
T> - Gibt zurück:
- true if the map contains mappings, false otherwise.
- Siehe auch:
-
keySet
Returns all keys of the map.- Angegeben von:
keySet
in SchnittstelleMap<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
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. -
hashCode
public int hashCode()Returns a hashCode for this object. The returned hashCode is consistent with equals(). -
toString
Returns a string representation of this map for debugging purposes.
-