Class AnnotationMap
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.AnnotationMap
-
- All Implemented Interfaces:
Annotations
public final class AnnotationMap extends java.lang.Object implements Annotations
Simple helper class used to keep track of collection of Jackson Annotations associated with annotatable things (methods, constructors, classes). Note that only Jackson-owned annotations are tracked (for now?).
-
-
Constructor Summary
Constructors Constructor Description AnnotationMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(java.lang.annotation.Annotation ann)
Method called to add specified annotation in the Map.boolean
addIfNotPresent(java.lang.annotation.Annotation ann)
Method called to add specified annotation in the Map, but only if it didn't yet exist.java.lang.Iterable<java.lang.annotation.Annotation>
annotations()
<A extends java.lang.annotation.Annotation>
Aget(java.lang.Class<A> cls)
Main access method used to find value for given annotation.boolean
has(java.lang.Class<?> cls)
boolean
hasOneOf(java.lang.Class<? extends java.lang.annotation.Annotation>[] annoClasses)
Helper method that can be used for a "bulk" check to see if at least one of given annotation types is included within this map.static AnnotationMap
merge(AnnotationMap primary, AnnotationMap secondary)
static AnnotationMap
of(java.lang.Class<?> type, java.lang.annotation.Annotation value)
int
size()
Returns number of annotation entries in this collection.java.lang.String
toString()
-
-
-
Method Detail
-
of
public static AnnotationMap of(java.lang.Class<?> type, java.lang.annotation.Annotation value)
-
get
public <A extends java.lang.annotation.Annotation> A get(java.lang.Class<A> cls)
Description copied from interface:Annotations
Main access method used to find value for given annotation.- Specified by:
get
in interfaceAnnotations
-
has
public boolean has(java.lang.Class<?> cls)
- Specified by:
has
in interfaceAnnotations
-
hasOneOf
public boolean hasOneOf(java.lang.Class<? extends java.lang.annotation.Annotation>[] annoClasses)
Helper method that can be used for a "bulk" check to see if at least one of given annotation types is included within this map.- Specified by:
hasOneOf
in interfaceAnnotations
- Since:
- 2.7
-
annotations
public java.lang.Iterable<java.lang.annotation.Annotation> annotations()
- Since:
- 2.3
-
merge
public static AnnotationMap merge(AnnotationMap primary, AnnotationMap secondary)
-
size
public int size()
Description copied from interface:Annotations
Returns number of annotation entries in this collection.- Specified by:
size
in interfaceAnnotations
-
addIfNotPresent
public boolean addIfNotPresent(java.lang.annotation.Annotation ann)
Method called to add specified annotation in the Map, but only if it didn't yet exist.
-
add
public boolean add(java.lang.annotation.Annotation ann)
Method called to add specified annotation in the Map.- Returns:
- True if the addition changed the contents, that is, this map did not already have specified annotation
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-