Top Description Fields Constructors Methods
org.hibernate.internal.util.collections

public final Class MapBackedClassValue<V>

extends Object
implements ReadOnlyMap<Class<T>, V>
Class Inheritance
All Implemented Interfaces
org.hibernate.internal.util.collections.ReadOnlyMap
Type Parameters
<V>
the type of the values stored in the Maps.
Imports
java.util.Map

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.
Author
Sanne Grinovero
Since
6.2

Field Summary

Modifier and TypeField and Description
private final ClassValue<V>
private volatile Map<Class<?>, V>

Constructor Summary

AccessConstructor and Description
public
MapBackedClassValue(final Map<Class<?>, V> map)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements org.hibernate.internal.util.collections.ReadOnlyMap.dispose.

Use this to wipe the backing map, important to avoid classloader leaks.
public V
get(Class<T> key)

Implements org.hibernate.internal.util.collections.ReadOnlyMap.get.

The main operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classValueback to summary
private final ClassValue<V> classValue
mapback to summary
private volatile Map<Class<?>, V> map

Constructor Detail

MapBackedClassValueback to summary
public MapBackedClassValue(final Map<Class<?>, V> map)

Method Detail

disposeback to summary
public void dispose()

Implements org.hibernate.internal.util.collections.ReadOnlyMap.dispose.

Use this to wipe the backing map, important to avoid classloader leaks.

Annotations
@Override
getback to summary
public V get(Class<T> key)

Implements org.hibernate.internal.util.collections.ReadOnlyMap.get.

Doc from org.hibernate.internal.util.collections.ReadOnlyMap.get.

The main operation.

Returns:V

the corresponding object, or null if there is no association with any entry.

Annotations
@Override