Package org.checkerframework.javacutil
Class AnnotationMirrorMap<V>
java.lang.Object
org.checkerframework.javacutil.AnnotationMirrorMap<V>
- All Implemented Interfaces:
Map<@KeyFor("this") AnnotationMirror,
V>
public class AnnotationMirrorMap<V>
extends Object
implements Map<@KeyFor("this") AnnotationMirror,V>
The Map interface defines some of its methods with respect to the equals method. This
implementation of Map violates those specifications, but fulfills the same property using
AnnotationUtils.areSame(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror)
.
For example, the specification for the containsKey(Object key) method says: "returns true if
and only if this map contains a mapping for a key k such that (key == null ? k == null :
key.equals(k))." The specification for containsKey(java.lang.Object)
is "returns true
if and only if this map contains a mapping for a key k such that (key == null ? k == null :
AnnotationUtils.areSame(key, k))."
AnnotationMirror is an interface and not all implementing classes provide a correct equals method; therefore, existing implementations of Map cannot be used.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDefault constructor.AnnotationMirrorMap
(Map<AnnotationMirror, ? extends V> copy) Creates an annotation mirror map and adds all the mappings incopy
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) static <V> AnnotationMirrorMap<V>
emptyMap()
Returns an empty set.Set<Map.Entry<@KeyFor("this") AnnotationMirror,
V>> entrySet()
boolean
int
hashCode()
boolean
isEmpty()
keySet()
Make this set unmodifiable.put
(AnnotationMirror key, V value) void
putAll
(Map<? extends AnnotationMirror, ? extends V> m) int
size()
toString()
static <V> AnnotationMirrorMap<V>
unmodifiableSet
(Map<AnnotationMirror, ? extends V> annos) Returns an unmodifiable AnnotationMirrorSet with the given elements.values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
AnnotationMirrorMap
public AnnotationMirrorMap()Default constructor. -
AnnotationMirrorMap
Creates an annotation mirror map and adds all the mappings incopy
.- Parameters:
copy
- a map whose contents should be copied to the newly created map
-
-
Method Details
-
unmodifiableSet
Returns an unmodifiable AnnotationMirrorSet with the given elements.- Type Parameters:
V
- the type of the values in the map- Parameters:
annos
- the annotation mirrors that will constitute the new unmodifable set- Returns:
- an unmodifiable AnnotationMirrorSet with the given elements
-
emptyMap
Returns an empty set.- Type Parameters:
V
- the type of the values in the map- Returns:
- an empty set
-
makeUnmodifiable
Make this set unmodifiable.- Returns:
- this set
-
size
public int size()- Specified by:
size
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
containsKey
- Specified by:
containsKey
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
get
- Specified by:
get
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
put
- Specified by:
put
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
remove
- Specified by:
remove
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
putAll
- Specified by:
putAll
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
clear
public void clear()- Specified by:
clear
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
keySet
- Specified by:
keySet
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
values
- Specified by:
values
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
entrySet
- Specified by:
entrySet
in interfaceMap<@KeyFor("this") AnnotationMirror,
V>
-
toString
-
equals
-
hashCode
public int hashCode()
-