Module io.leangen.geantyref
Package io.leangen.geantyref
Class AnnotatedTypeMap<K extends AnnotatedType,V>
java.lang.Object
io.leangen.geantyref.AnnotatedTypeMap<K,V>
- Type Parameters:
V- the type of mapped values
- All Implemented Interfaces:
Map<K,V>
A
Map implementation keyed by AnnotatedType.
The standard maps do not usually suffice as AnnotatedType implements neither equals nor hashCode.
This implementation overcomes that limitation by transparently turning each AnnotatedType used as the key
into the canonical form using GenericTypeReflector.toCanonical(AnnotatedType).
By default, AnnotatedTypeMap instances are backed by a HashMap, but any map can be used instead.
The guarantees of AnnotatedTypeMap are then the same as of the map it is backed by.- See Also:
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance backed by aHashMapAnnotatedTypeMap(Map<K, V> inner) Constructs an instance backed by the provided map, keeping its guarantees -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanvoidforEach(BiConsumer<? super K, ? super V> action) getOrDefault(Object key, V defaultValue) inthashCode()booleanisEmpty()keySet()voidputIfAbsent(K key, V value) booleanbooleanvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) intsize()values()
-
Field Details
-
inner
-
-
Constructor Details
-
AnnotatedTypeMap
public AnnotatedTypeMap()Constructs an instance backed by aHashMap -
AnnotatedTypeMap
Constructs an instance backed by the provided map, keeping its guarantees- Parameters:
inner- A non-null map instance that will back the constructedAnnotatedTypeMap
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceMap<K extends AnnotatedType,V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<K extends AnnotatedType,V>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K extends AnnotatedType,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K extends AnnotatedType,V>
-
get
- Specified by:
getin interfaceMap<K extends AnnotatedType,V>
-
put
- Specified by:
putin interfaceMap<K extends AnnotatedType,V>
-
remove
- Specified by:
removein interfaceMap<K extends AnnotatedType,V>
-
putAll
- Specified by:
putAllin interfaceMap<K extends AnnotatedType,V>
-
clear
public void clear()- Specified by:
clearin interfaceMap<K extends AnnotatedType,V>
-
keySet
- Specified by:
keySetin interfaceMap<K extends AnnotatedType,V>
-
values
- Specified by:
valuesin interfaceMap<K extends AnnotatedType,V>
-
entrySet
- Specified by:
entrySetin interfaceMap<K extends AnnotatedType,V>
-
equals
-
hashCode
public int hashCode() -
getOrDefault
- Specified by:
getOrDefaultin interfaceMap<K extends AnnotatedType,V>
-
forEach
- Specified by:
forEachin interfaceMap<K extends AnnotatedType,V>
-
replaceAll
- Specified by:
replaceAllin interfaceMap<K extends AnnotatedType,V>
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceMap<K extends AnnotatedType,V>
-
remove
- Specified by:
removein interfaceMap<K extends AnnotatedType,V>
-
replace
- Specified by:
replacein interfaceMap<K extends AnnotatedType,V>
-
replace
- Specified by:
replacein interfaceMap<K extends AnnotatedType,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceMap<K extends AnnotatedType,V>
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceMap<K extends AnnotatedType,V>
-
compute
- Specified by:
computein interfaceMap<K extends AnnotatedType,V>
-
merge
- Specified by:
mergein interfaceMap<K extends AnnotatedType,V>
-