Package org.checkerframework.javacutil
Class AnnotationMirrorMap<V>
- java.lang.Object
-
- org.checkerframework.javacutil.AnnotationMirrorMap<V>
-
- All Implemented Interfaces:
java.util.Map<@KeyFor("this") javax.lang.model.element.AnnotationMirror,V>
public class AnnotationMirrorMap<V> extends java.lang.Object implements java.util.Map<@KeyFor("this") javax.lang.model.element.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 usingAnnotationUtils.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.
-
-
Constructor Summary
Constructors Constructor Description AnnotationMirrorMap()
Default constructor.AnnotationMirrorMap(java.util.Map<javax.lang.model.element.AnnotationMirror,? extends V> copy)
Creates an annotation mirror map and adds all the mappings incopy
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
java.util.Set<java.util.Map.Entry<@KeyFor("this") javax.lang.model.element.AnnotationMirror,V>>
entrySet()
boolean
equals(@Nullable java.lang.Object o)
@Nullable V
get(java.lang.Object key)
int
hashCode()
boolean
isEmpty()
AnnotationMirrorSet
keySet()
@Nullable V
put(javax.lang.model.element.AnnotationMirror key, V value)
void
putAll(java.util.Map<? extends javax.lang.model.element.AnnotationMirror,? extends V> m)
@Nullable V
remove(java.lang.Object key)
int
size()
java.lang.String
toString()
java.util.Collection<V>
values()
-
-
-
Constructor Detail
-
AnnotationMirrorMap
public AnnotationMirrorMap()
Default constructor.
-
AnnotationMirrorMap
public AnnotationMirrorMap(java.util.Map<javax.lang.model.element.AnnotationMirror,? extends V> copy)
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 Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
-
putAll
public void putAll(java.util.Map<? extends javax.lang.model.element.AnnotationMirror,? extends V> m)
-
clear
public void clear()
-
keySet
public AnnotationMirrorSet keySet()
-
values
public java.util.Collection<V> values()
-
entrySet
public java.util.Set<java.util.Map.Entry<@KeyFor("this") javax.lang.model.element.AnnotationMirror,V>> entrySet()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-