com.fasterxml.jackson.databind.introspect

## Class AnnotatedClass

- java.lang.Object
- - com.fasterxml.jackson.databind.introspect.Annotated
  - - com.fasterxml.jackson.databind.introspect.AnnotatedClass

- All Implemented Interfaces:
    TypeResolutionContext

      public final class AnnotatedClass
      extends Annotated
      implements TypeResolutionContext

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.introspect.TypeResolutionContext

      `TypeResolutionContext.Basic`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AnnotationIntrospector` | `_annotationIntrospector` Filter used to determine which annotations to gather; used to optimize things so that unnecessary annotations are ignored.
    `protected TypeBindings` | `_bindings` Type bindings to use for members of `_class`.
    `protected java.lang.Class<?>` | `_class` Class for which annotations apply, and that owns other components (constructors, methods)
    `protected AnnotationMap` | `_classAnnotations` Combined list of Jackson annotations that the class has, including inheritable ones from super classes and interfaces
    `protected java.util.List<AnnotatedConstructor>` | `_constructors` Single argument constructors the class has, if any.
    `protected java.util.List<AnnotatedMethod>` | `_creatorMethods` Single argument static methods that might be usable as factory methods
    `protected boolean` | `_creatorsResolved` Flag to indicate whether creator information has been resolved or not.
    `protected AnnotatedConstructor` | `_defaultConstructor` Default constructor of the annotated class, if it has one.
    `protected java.util.List<AnnotatedField>` | `_fields` Member fields of interest: ones that are either public, or have at least one annotation.
    `protected AnnotatedMethodMap` | `_memberMethods` Member methods of interest; for now ones with 0 or 1 arguments (just optimization, since others won't be used now)
    `protected ClassIntrospector.MixInResolver` | `_mixInResolver` Object that knows mapping of mix-in classes (ones that contain annotations to add) with their target classes (ones that get these additional annotations "mixed in").
    `protected java.lang.Class<?>` | `_primaryMixIn` Primary mix-in class; one to use for the annotated class itself.
    `protected java.util.List<JavaType>` | `_superTypes` Ordered set of super classes and interfaces of the class itself: included in order of precedence
    `protected JavaType` | `_type`
    `protected TypeFactory` | `_typeFactory`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `_addClassMixIns(AnnotationMap annotations, java.lang.Class<?> target)`
    `protected void` | `_addClassMixIns(AnnotationMap annotations, java.lang.Class<?> toMask, java.lang.Class<?> mixin)`
    `protected void` | `_addClassMixIns(AnnotationMap annotations, JavaType target)` Helper method for adding any mix-in annotations specified class might have.
    `protected void` | `_addConstructorMixIns(java.lang.Class<?> mixin)`
    `protected void` | `_addFactoryMixIns(java.lang.Class<?> mixin)`
    `protected void` | `_addFieldMixIns(java.lang.Class<?> mixInCls, java.lang.Class<?> targetClass, java.util.Map<java.lang.String,AnnotatedField> fields)` Method called to add field mix-ins from given mix-in class (and its fields) into already collected actual fields (from introspected classes and their super-classes)
    `protected void` | `_addMemberMethods(java.lang.Class<?> cls, TypeResolutionContext typeContext, AnnotatedMethodMap methods, java.lang.Class<?> mixInCls, AnnotatedMethodMap mixIns)`
    `protected void` | `_addMethodMixIns(java.lang.Class<?> targetClass, AnnotatedMethodMap methods, java.lang.Class<?> mixInCls, AnnotatedMethodMap mixIns)`
    `protected void` | `_addMixOvers(java.lang.reflect.Constructor<?> mixin, AnnotatedConstructor target, boolean addParamAnnotations)`
    `protected void` | `_addMixOvers(java.lang.reflect.Method mixin, AnnotatedMethod target, boolean addParamAnnotations)`
    `protected void` | `_addMixUnders(java.lang.reflect.Method src, AnnotatedMethod target)` Method that will add annotations from specified source method to target method, but only if target does not yet have them.
    `protected AnnotationMap` | `_collectRelevantAnnotations(java.lang.annotation.Annotation[] anns)`
    `protected AnnotationMap[]` | `_collectRelevantAnnotations(java.lang.annotation.Annotation[][] anns)`
    `protected AnnotatedMethod` | `_constructCreatorMethod(java.lang.reflect.Method m, TypeResolutionContext typeContext)`
    `protected AnnotatedConstructor` | `_constructDefaultConstructor(ClassUtil.Ctor ctor, TypeResolutionContext typeContext)`
    `protected AnnotatedField` | `_constructField(java.lang.reflect.Field f, TypeResolutionContext typeContext)`
    `protected AnnotatedMethod` | `_constructMethod(java.lang.reflect.Method m, TypeResolutionContext typeContext)`
    `protected AnnotatedConstructor` | `_constructNonDefaultConstructor(ClassUtil.Ctor ctor, TypeResolutionContext typeContext)`
    `protected java.lang.reflect.Method[]` | `_findClassMethods(java.lang.Class<?> cls)` Helper method that gets methods declared in given class; usually a simple thing, but sometimes (as per [databind#785]) more complicated, depending on classloader setup.
    `protected java.util.Map<java.lang.String,AnnotatedField>` | `_findFields(JavaType type, TypeResolutionContext typeContext, java.util.Map<java.lang.String,AnnotatedField> fields)`
    `protected boolean` | `_isIncludableMemberMethod(java.lang.reflect.Method m)`
    `java.lang.Iterable<java.lang.annotation.Annotation>` | `annotations()` Accessor that can be used to iterate over all the annotations associated with annotated component.
    `static AnnotatedClass` | `construct(JavaType type, MapperConfig<?> config)` Factory method that instantiates an instance.
    `static AnnotatedClass` | `construct(JavaType type, MapperConfig<?> config, ClassIntrospector.MixInResolver mir)`
    `static AnnotatedClass` | `constructWithoutSuperTypes(java.lang.Class<?> cls, MapperConfig<?> config)` Method similar to `construct(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.cfg.MapperConfig<?>)`, but that will NOT include information from supertypes; only class itself and any direct mix-ins it may have.
    `static AnnotatedClass` | `constructWithoutSuperTypes(java.lang.Class<?> cls, MapperConfig<?> config, ClassIntrospector.MixInResolver mir)`
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.Iterable<AnnotatedField>` | `fields()`
    `AnnotatedMethod` | `findMethod(java.lang.String name, java.lang.Class<?>[] paramTypes)`
    `protected AnnotationMap` | `getAllAnnotations()` Internal helper method used to access annotation information; not exposed to developers since instances are mutable.
    `java.lang.Class<?>` | `getAnnotated()` Method that can be used to find actual JDK element that this instance represents.
    `<A extends java.lang.annotation.Annotation> A` | `getAnnotation(java.lang.Class<A> acls)`
    `Annotations` | `getAnnotations()`
    `java.util.List<AnnotatedConstructor>` | `getConstructors()`
    `AnnotatedConstructor` | `getDefaultConstructor()`
    `int` | `getFieldCount()`
    `int` | `getMemberMethodCount()`
    `int` | `getModifiers()`
    `java.lang.String` | `getName()`
    `java.lang.Class<?>` | `getRawType()` "Raw" type (type-erased class) of the annotated element; definition of what exactly this means depends on sub-class.
    `java.util.List<AnnotatedMethod>` | `getStaticMethods()`
    `JavaType` | `getType()` Full generic type of the annotated element; definition of what exactly this means depends on sub-class.
    `boolean` | `hasAnnotation(java.lang.Class<?> acls)`
    `boolean` | `hasAnnotations()`
    `int` | `hashCode()`
    `boolean` | `hasOneOf(java.lang.Class<? extends java.lang.annotation.Annotation>[] annoClasses)`
    `java.lang.Iterable<AnnotatedMethod>` | `memberMethods()`
    `JavaType` | `resolveType(java.lang.reflect.Type type)`
    `java.lang.String` | `toString()`
    `AnnotatedClass` | `withAnnotations(AnnotationMap ann)` Fluent factory method that will construct a new instance that uses specified instance annotations instead of currently configured ones.

    - ### Methods inherited from class com.fasterxml.jackson.databind.introspect.Annotated

      `getGenericType, getType, isPublic, withFallBackAnnotationsFrom`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _type

          protected final JavaType _type

      Since:
        2.7

    - #### _class

          protected final java.lang.Class<?> _class

      Class for which annotations apply, and that owns other components (constructors, methods)

    - #### _bindings

          protected final TypeBindings _bindings

      Type bindings to use for members of `_class`.
      Since:
        2.7

    - #### _superTypes

          protected final java.util.List<JavaType> _superTypes

      Ordered set of super classes and interfaces of the class itself: included in order of precedence

      NOTE: changed in 2.7 from List of `Class`es to List of `JavaType`s.

    - #### _annotationIntrospector

          protected final AnnotationIntrospector _annotationIntrospector

      Filter used to determine which annotations to gather; used to optimize things so that unnecessary annotations are ignored.

    - #### _typeFactory

          protected final TypeFactory _typeFactory

      Since:
        2.7

    - #### _mixInResolver

          protected final ClassIntrospector.MixInResolver _mixInResolver

      Object that knows mapping of mix-in classes (ones that contain annotations to add) with their target classes (ones that get these additional annotations "mixed in").

    - #### _primaryMixIn

          protected final java.lang.Class<?> _primaryMixIn

      Primary mix-in class; one to use for the annotated class itself. Can be null.

    - #### _classAnnotations

          protected AnnotationMap _classAnnotations

      Combined list of Jackson annotations that the class has, including inheritable ones from super classes and interfaces

    - #### _creatorsResolved

          protected boolean _creatorsResolved

      Flag to indicate whether creator information has been resolved or not.

    - #### _defaultConstructor

          protected AnnotatedConstructor _defaultConstructor

      Default constructor of the annotated class, if it has one.

    - #### _constructors

          protected java.util.List<AnnotatedConstructor> _constructors

      Single argument constructors the class has, if any.

    - #### _creatorMethods

          protected java.util.List<AnnotatedMethod> _creatorMethods

      Single argument static methods that might be usable as factory methods

    - #### _memberMethods

          protected AnnotatedMethodMap _memberMethods

      Member methods of interest; for now ones with 0 or 1 arguments (just optimization, since others won't be used now)

    - #### _fields

          protected java.util.List<AnnotatedField> _fields

      Member fields of interest: ones that are either public, or have at least one annotation.

  - ### Method Detail

    - #### withAnnotations

          public AnnotatedClass withAnnotations(AnnotationMap ann)

      Description copied from class: `Annotated`
      Fluent factory method that will construct a new instance that uses specified instance annotations instead of currently configured ones.
      Specified by:
        `withAnnotations` in class `Annotated`

    - #### construct

          public static AnnotatedClass construct(JavaType type,
                                 MapperConfig<?> config)

      Factory method that instantiates an instance. Returned instance will only be initialized with class annotations, but not with any method information.
      Since:
        2.7

    - #### construct

          public static AnnotatedClass construct(JavaType type,
                                 MapperConfig<?> config,
                                 ClassIntrospector.MixInResolver mir)

      Since:
        2.7

    - #### constructWithoutSuperTypes

          public static AnnotatedClass constructWithoutSuperTypes(java.lang.Class<?> cls,
                                                  MapperConfig<?> config)

      Method similar to `construct(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.cfg.MapperConfig<?>)`, but that will NOT include information from supertypes; only class itself and any direct mix-ins it may have.

    - #### constructWithoutSuperTypes

          public static AnnotatedClass constructWithoutSuperTypes(java.lang.Class<?> cls,
                                                  MapperConfig<?> config,
                                                  ClassIntrospector.MixInResolver mir)

    - #### resolveType

          public JavaType resolveType(java.lang.reflect.Type type)

      Specified by:
        `resolveType` in interface `TypeResolutionContext`

    - #### getAnnotated

          public java.lang.Class<?> getAnnotated()

      Description copied from class: `Annotated`
      Method that can be used to find actual JDK element that this instance represents. It is non-null, except for method/constructor parameters which do not have a JDK counterpart.
      Specified by:
        `getAnnotated` in class `Annotated`

    - #### getModifiers

          public int getModifiers()

      Specified by:
        `getModifiers` in class `Annotated`

    - #### getName

          public java.lang.String getName()

      Specified by:
        `getName` in class `Annotated`

    - #### getAnnotation

          public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)

      Specified by:
        `getAnnotation` in class `Annotated`

    - #### hasAnnotation

          public boolean hasAnnotation(java.lang.Class<?> acls)

      Specified by:
        `hasAnnotation` in class `Annotated`

    - #### hasOneOf

          public boolean hasOneOf(java.lang.Class<? extends java.lang.annotation.Annotation>[] annoClasses)

      Specified by:
        `hasOneOf` in class `Annotated`

    - #### getRawType

          public java.lang.Class<?> getRawType()

      Description copied from class: `Annotated`
      "Raw" type (type-erased class) of the annotated element; definition of what exactly this means depends on sub-class.
      Specified by:
        `getRawType` in class `Annotated`

    - #### annotations

          public java.lang.Iterable<java.lang.annotation.Annotation> annotations()

      Description copied from class: `Annotated`
      Accessor that can be used to iterate over all the annotations associated with annotated component.
      Specified by:
        `annotations` in class `Annotated`

    - #### getAllAnnotations

          protected AnnotationMap getAllAnnotations()

      Description copied from class: `Annotated`
      Internal helper method used to access annotation information; not exposed to developers since instances are mutable.
      Specified by:
        `getAllAnnotations` in class `Annotated`

    - #### getType

          public JavaType getType()

      Description copied from class: `Annotated`
      Full generic type of the annotated element; definition of what exactly this means depends on sub-class.
      Specified by:
        `getType` in class `Annotated`

    - #### getAnnotations

          public Annotations getAnnotations()

    - #### hasAnnotations

          public boolean hasAnnotations()

    - #### getDefaultConstructor

          public AnnotatedConstructor getDefaultConstructor()

    - #### getConstructors

          public java.util.List<AnnotatedConstructor> getConstructors()

    - #### getStaticMethods

          public java.util.List<AnnotatedMethod> getStaticMethods()

    - #### memberMethods

          public java.lang.Iterable<AnnotatedMethod> memberMethods()

    - #### getMemberMethodCount

          public int getMemberMethodCount()

    - #### findMethod

          public AnnotatedMethod findMethod(java.lang.String name,
                                   java.lang.Class<?>[] paramTypes)

    - #### getFieldCount

          public int getFieldCount()

    - #### fields

          public java.lang.Iterable<AnnotatedField> fields()

    - #### _addClassMixIns

          protected void _addClassMixIns(AnnotationMap annotations,
                             JavaType target)

      Helper method for adding any mix-in annotations specified class might have.

    - #### _addClassMixIns

          protected void _addClassMixIns(AnnotationMap annotations,
                             java.lang.Class<?> target)

    - #### _addClassMixIns

          protected void _addClassMixIns(AnnotationMap annotations,
                             java.lang.Class<?> toMask,
                             java.lang.Class<?> mixin)

    - #### _addConstructorMixIns

          protected void _addConstructorMixIns(java.lang.Class<?> mixin)

    - #### _addFactoryMixIns

          protected void _addFactoryMixIns(java.lang.Class<?> mixin)

    - #### _addMemberMethods

          protected void _addMemberMethods(java.lang.Class<?> cls,
                               TypeResolutionContext typeContext,
                               AnnotatedMethodMap methods,
                               java.lang.Class<?> mixInCls,
                               AnnotatedMethodMap mixIns)

    - #### _addMethodMixIns

          protected void _addMethodMixIns(java.lang.Class<?> targetClass,
                              AnnotatedMethodMap methods,
                              java.lang.Class<?> mixInCls,
                              AnnotatedMethodMap mixIns)

    - #### _findFields

          protected java.util.Map<java.lang.String,AnnotatedField> _findFields(JavaType type,
                                                                   TypeResolutionContext typeContext,
                                                                   java.util.Map<java.lang.String,AnnotatedField> fields)

    - #### _addFieldMixIns

          protected void _addFieldMixIns(java.lang.Class<?> mixInCls,
                             java.lang.Class<?> targetClass,
                             java.util.Map<java.lang.String,AnnotatedField> fields)

      Method called to add field mix-ins from given mix-in class (and its fields) into already collected actual fields (from introspected classes and their super-classes)

    - #### _constructMethod

          protected AnnotatedMethod _constructMethod(java.lang.reflect.Method m,
                                         TypeResolutionContext typeContext)

    - #### _constructDefaultConstructor

          protected AnnotatedConstructor _constructDefaultConstructor(ClassUtil.Ctor ctor,
                                                          TypeResolutionContext typeContext)

    - #### _constructNonDefaultConstructor

          protected AnnotatedConstructor _constructNonDefaultConstructor(ClassUtil.Ctor ctor,
                                                             TypeResolutionContext typeContext)

    - #### _constructCreatorMethod

          protected AnnotatedMethod _constructCreatorMethod(java.lang.reflect.Method m,
                                                TypeResolutionContext typeContext)

    - #### _constructField

          protected AnnotatedField _constructField(java.lang.reflect.Field f,
                                       TypeResolutionContext typeContext)

    - #### _isIncludableMemberMethod

          protected boolean _isIncludableMemberMethod(java.lang.reflect.Method m)

    - #### _collectRelevantAnnotations

          protected AnnotationMap[] _collectRelevantAnnotations(java.lang.annotation.Annotation[][] anns)

    - #### _collectRelevantAnnotations

          protected AnnotationMap _collectRelevantAnnotations(java.lang.annotation.Annotation[] anns)

    - #### _addMixOvers

          protected void _addMixOvers(java.lang.reflect.Constructor<?> mixin,
                          AnnotatedConstructor target,
                          boolean addParamAnnotations)

      Parameters:
        `addParamAnnotations` - Whether parameter annotations are to be added as well

    - #### _addMixOvers

          protected void _addMixOvers(java.lang.reflect.Method mixin,
                          AnnotatedMethod target,
                          boolean addParamAnnotations)

      Parameters:
        `addParamAnnotations` - Whether parameter annotations are to be added as well

    - #### _addMixUnders

          protected void _addMixUnders(java.lang.reflect.Method src,
                           AnnotatedMethod target)

      Method that will add annotations from specified source method to target method, but only if target does not yet have them.

    - #### _findClassMethods

          protected java.lang.reflect.Method[] _findClassMethods(java.lang.Class<?> cls)

      Helper method that gets methods declared in given class; usually a simple thing, but sometimes (as per [databind#785]) more complicated, depending on classloader setup.
      Since:
        2.4.7

    - #### toString

          public java.lang.String toString()

      Specified by:
        `toString` in class `Annotated`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Annotated`

    - #### equals

          public boolean equals(java.lang.Object o)

      Specified by:
        `equals` in class `Annotated`