Class AnnotationMap
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.AnnotationMap
-
- All Implemented Interfaces:
Annotations
public final class AnnotationMap extends 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?).
-
-
Field Summary
Fields Modifier and Type Field Description protected HashMap<Class<?>,Annotation>_annotations
-
Constructor Summary
Constructors Constructor Description AnnotationMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_add(Annotation ann)booleanadd(Annotation ann)Method called to add specified annotation in the Map.booleanaddIfNotPresent(Annotation ann)Method called to add specified annotation in the Map, but only if it didn't yet exist.Iterable<Annotation>annotations()<A extends Annotation>
Aget(Class<A> cls)Main access method used to find value for given annotation.booleanhas(Class<?> cls)booleanhasOneOf(Class<? extends 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 AnnotationMapmerge(AnnotationMap primary, AnnotationMap secondary)static AnnotationMapof(Class<?> type, Annotation value)intsize()Returns number of annotation entries in this collection.StringtoString()
-
-
-
Field Detail
-
_annotations
protected HashMap<Class<?>,Annotation> _annotations
-
-
Method Detail
-
of
public static AnnotationMap of(Class<?> type, Annotation value)
-
get
public <A extends Annotation> A get(Class<A> cls)
Description copied from interface:AnnotationsMain access method used to find value for given annotation.- Specified by:
getin interfaceAnnotations
-
has
public boolean has(Class<?> cls)
- Specified by:
hasin interfaceAnnotations
-
hasOneOf
public boolean hasOneOf(Class<? extends 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:
hasOneOfin interfaceAnnotations- Since:
- 2.7
-
annotations
public Iterable<Annotation> annotations()
- Since:
- 2.3
-
merge
public static AnnotationMap merge(AnnotationMap primary, AnnotationMap secondary)
-
size
public int size()
Description copied from interface:AnnotationsReturns number of annotation entries in this collection.- Specified by:
sizein interfaceAnnotations
-
addIfNotPresent
public boolean addIfNotPresent(Annotation ann)
Method called to add specified annotation in the Map, but only if it didn't yet exist.
-
add
public boolean add(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
-
_add
protected final boolean _add(Annotation ann)
-
-