Top Description Inners Fields Constructors Methods
org.hibernate.annotations.common.reflection.java

pack-priv final Class TypeEnvironmentMap<K, V>

extends Object
Class Inheritance
Imports
java.util.HashMap, .Objects, org.hibernate.annotations.common.reflection.java.generics.TypeEnvironment

We need a two-level sparse tree for best efficiency in this case; the first split uses TypeEnvironment as a key, under which we store an additional Map to further organize by K. This used to be implemented as a HashMap with a composite key {TypeEnvironment,K}, but this wasn't memory efficient as all composite keys take too much space: the nested structure has some overhead as well, but has been shown to cost less overall. In addition, we strife to not need to compute hashkeys multiple times while not needing to allocate stateful lambdas; for this reason the tree nodes need to store some additional references.
Author
Sanne Grinovero

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final XTypeConstruction<K, V>
private HashMap<TypeEnvironment, TypeEnvironmentMap<K, V>.ContextScope>

Constructor Summary

AccessConstructor and Description
pack-priv
TypeEnvironmentMap(final XTypeConstruction<K, V> constructionMethod)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv V
getOrCompute(final TypeEnvironment context, final K subKey)

private <K, V> HashMap<TypeEnvironment, TypeEnvironmentMap<K, V>.ContextScope>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

constructionMethodback to summary
private final XTypeConstruction<K, V> constructionMethod
rootMapback to summary
private HashMap<TypeEnvironment, TypeEnvironmentMap<K, V>.ContextScope> rootMap

Constructor Detail

TypeEnvironmentMapback to summary
pack-priv TypeEnvironmentMap(final XTypeConstruction<K, V> constructionMethod)

Method Detail

clearback to summary
pack-priv void clear()
getOrComputeback to summary
pack-priv V getOrCompute(final TypeEnvironment context, final K subKey)
getOrInitRootMapback to summary
private <K, V> HashMap<TypeEnvironment, TypeEnvironmentMap<K, V>.ContextScope> getOrInitRootMap()
org.hibernate.annotations.common.reflection.java back to summary

private final Class TypeEnvironmentMap.ContextScope

extends HashMap<K, V>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final TypeEnvironment

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private V
buildObject(K subKey)

private V
getOrCompute(K subKey)

Inherited from java.util.HashMap:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValueentrySetforEachgetgetOrDefaultisEmptykeySetmergenewHashMapputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Field Detail

contextback to summary
private final TypeEnvironment context

Constructor Detail

ContextScopeback to summary
private ContextScope(TypeEnvironment context)

Method Detail

buildObjectback to summary
private V buildObject(K subKey)
getOrComputeback to summary
private V getOrCompute(K subKey)