Class MapBackedClassValue<V>
java.lang.Object
org.hibernate.internal.util.collections.MapBackedClassValue<V>
- Type Parameters:
V
- the type of the values stored in the Maps.
- All Implemented Interfaces:
ReadOnlyMap<Class,
V>
For efficient lookup based on Class types as key,
a ClassValue should be used; however it requires
lazy association of values; this helper wraps
a plain HashMap but optimises lookups via the ClassValue.
N.B. there is a cost in memory and in terms of weak references,
so let's use this only where proven that a simple Map lookup
is otherwise too costly.
- Since:
- 6.2
-
Field Summary
Fields inherited from interface org.hibernate.internal.util.collections.ReadOnlyMap
EMPTY
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MapBackedClassValue
-
-
Method Details
-
get
Description copied from interface:ReadOnlyMap
The main operation.- Specified by:
get
in interfaceReadOnlyMap<Class,
V> - Returns:
- the corresponding object, or null if there is no association with any entry.
-
dispose
public void dispose()Use this to wipe the backing map, important to avoid classloader leaks.- Specified by:
dispose
in interfaceReadOnlyMap<Class,
V>
-