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 aHashMap
AnnotatedTypeMap
(Map<K, V> inner) Constructs an instance backed by the provided map, keeping its guarantees -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
void
forEach
(BiConsumer<? super K, ? super V> action) getOrDefault
(Object key, V defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
void
putIfAbsent
(K key, V value) boolean
boolean
void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) int
size()
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:
size
in interfaceMap<K extends AnnotatedType,
V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<K extends AnnotatedType,
V>
-
containsKey
- Specified by:
containsKey
in interfaceMap<K extends AnnotatedType,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K extends AnnotatedType,
V>
-
get
- Specified by:
get
in interfaceMap<K extends AnnotatedType,
V>
-
put
- Specified by:
put
in interfaceMap<K extends AnnotatedType,
V>
-
remove
- Specified by:
remove
in interfaceMap<K extends AnnotatedType,
V>
-
putAll
- Specified by:
putAll
in interfaceMap<K extends AnnotatedType,
V>
-
clear
public void clear()- Specified by:
clear
in interfaceMap<K extends AnnotatedType,
V>
-
keySet
- Specified by:
keySet
in interfaceMap<K extends AnnotatedType,
V>
-
values
- Specified by:
values
in interfaceMap<K extends AnnotatedType,
V>
-
entrySet
- Specified by:
entrySet
in interfaceMap<K extends AnnotatedType,
V>
-
equals
-
hashCode
public int hashCode() -
getOrDefault
- Specified by:
getOrDefault
in interfaceMap<K extends AnnotatedType,
V>
-
forEach
- Specified by:
forEach
in interfaceMap<K extends AnnotatedType,
V>
-
replaceAll
- Specified by:
replaceAll
in interfaceMap<K extends AnnotatedType,
V>
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceMap<K extends AnnotatedType,
V>
-
remove
- Specified by:
remove
in interfaceMap<K extends AnnotatedType,
V>
-
replace
- Specified by:
replace
in interfaceMap<K extends AnnotatedType,
V>
-
replace
- Specified by:
replace
in interfaceMap<K extends AnnotatedType,
V>
-
computeIfAbsent
- Specified by:
computeIfAbsent
in interfaceMap<K extends AnnotatedType,
V>
-
computeIfPresent
- Specified by:
computeIfPresent
in interfaceMap<K extends AnnotatedType,
V>
-
compute
- Specified by:
compute
in interfaceMap<K extends AnnotatedType,
V>
-
merge
- Specified by:
merge
in interfaceMap<K extends AnnotatedType,
V>
-