AnnotatedMember
Date: 2016-12-04

com.fasterxml.jackson.databind.introspect

## Class AnnotatedMember

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

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    AnnotatedField, AnnotatedParameter, AnnotatedWithParams, VirtualAnnotatedMember

      public abstract class AnnotatedMember
      extends Annotated
      implements java.io.Serializable

  Intermediate base class for annotated entities that are members of a class; fields, methods and constructors. This is a superset of things that can represent logical properties as it contains constructors in addition to fields and methods.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AnnotationMap` | `_annotations`
    `protected TypeResolutionContext` | `_typeContext` Context object needed for resolving generic type associated with this member (method parameter or return value, or field type).

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AnnotatedMember(AnnotatedMember base)` Copy-constructor.
    `protected` | `AnnotatedMember(TypeResolutionContext ctxt, AnnotationMap annotations)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addIfNotPresent(java.lang.annotation.Annotation a)` Method called to augment annotations, by adding specified annotation if and only if it is not yet present in the annotation map we have.
    `boolean` | `addOrOverride(java.lang.annotation.Annotation a)` Method called to override an annotation, usually due to a mix-in annotation masking or overriding an annotation 'real' constructor has.
    `java.lang.Iterable<java.lang.annotation.Annotation>` | `annotations()` Accessor that can be used to iterate over all the annotations associated with annotated component.
    `void` | `fixAccess()` Deprecated. Since 2.7 use `fixAccess(boolean)` instead
    `void` | `fixAccess(boolean force)` Method that can be called to modify access rights, by calling `AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean)` on the underlying annotated element.
    `protected AnnotationMap` | `getAllAnnotations()` Internal helper method used to access annotation information; not exposed to developers since instances are mutable.
    `<A extends java.lang.annotation.Annotation> A` | `getAnnotation(java.lang.Class<A> acls)`
    `abstract java.lang.Class<?>` | `getDeclaringClass()` Actual physical class in which this memmber was declared.
    `abstract java.lang.reflect.Member` | `getMember()`
    `TypeResolutionContext` | `getTypeContext()` Accessor for `TypeResolutionContext` that is used for resolving full generic type of this member.
    `abstract java.lang.Object` | `getValue(java.lang.Object pojo)` Optional method that can be used to access the value of this member on given object, if this is a supported operation for member type.
    `boolean` | `hasAnnotation(java.lang.Class<?> acls)`
    `boolean` | `hasOneOf(java.lang.Class<? extends java.lang.annotation.Annotation>[] annoClasses)`
    `abstract void` | `setValue(java.lang.Object pojo, java.lang.Object value)` Optional method that can be used to assign value of this member on given object, if this is a supported operation for member type.

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

      `equals, getAnnotated, getGenericType, getModifiers, getName, getRawType, getType, getType, hashCode, isPublic, toString, withAnnotations, withFallBackAnnotationsFrom`

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

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

- - ### Field Detail

    - #### _typeContext

          protected final transient TypeResolutionContext _typeContext

      Context object needed for resolving generic type associated with this member (method parameter or return value, or field type).
      Since:
        2.7

    - #### _annotations

          protected final transient AnnotationMap _annotations

  - ### Constructor Detail

    - #### AnnotatedMember

          protected AnnotatedMember(TypeResolutionContext ctxt,
                         AnnotationMap annotations)

    - #### AnnotatedMember

          protected AnnotatedMember(AnnotatedMember base)

      Copy-constructor.
      Since:
        2.5

  - ### Method Detail

    - #### getDeclaringClass

          public abstract java.lang.Class<?> getDeclaringClass()

      Actual physical class in which this memmber was declared.

    - #### getMember

          public abstract java.lang.reflect.Member getMember()

    - #### getTypeContext

          public TypeResolutionContext getTypeContext()

      Accessor for `TypeResolutionContext` that is used for resolving full generic type of this member.
      Since:
        2.7

    - #### getAnnotation

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

      Specified by:
        `getAnnotation` in class `Annotated`

    - #### hasAnnotation

          public final 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`

    - #### 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`

    - #### addOrOverride

          public final boolean addOrOverride(java.lang.annotation.Annotation a)

      Method called to override an annotation, usually due to a mix-in annotation masking or overriding an annotation 'real' constructor has.

    - #### addIfNotPresent

          public final boolean addIfNotPresent(java.lang.annotation.Annotation a)

      Method called to augment annotations, by adding specified annotation if and only if it is not yet present in the annotation map we have.

    - #### fixAccess

          public final void fixAccess(boolean force)

      Method that can be called to modify access rights, by calling `AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean)` on the underlying annotated element.

      Note that caller should verify that `MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS` is enabled before calling this method; as well as pass `force` flag appropriately.

      Since:
        2.7

    - #### fixAccess

          @Deprecated
          public final void fixAccess()

      Deprecated. Since 2.7 use `fixAccess(boolean)` instead

    - #### setValue

          public abstract void setValue(java.lang.Object pojo,
                      java.lang.Object value)
                                 throws java.lang.UnsupportedOperationException,
                                        java.lang.IllegalArgumentException

      Optional method that can be used to assign value of this member on given object, if this is a supported operation for member type.

      This is implemented for fields and single-argument member methods; but not for constructor parameters or other types of methods (like static methods)

      Throws:
        `java.lang.UnsupportedOperationException`
        `java.lang.IllegalArgumentException`

    - #### getValue

          public abstract java.lang.Object getValue(java.lang.Object pojo)
                                             throws java.lang.UnsupportedOperationException,
                                                    java.lang.IllegalArgumentException

      Optional method that can be used to access the value of this member on given object, if this is a supported operation for member type.

      This is implemented for fields and no-argument member methods; but not for constructor parameters or other types of methods (like static methods)

      Throws:
        `java.lang.UnsupportedOperationException`
        `java.lang.IllegalArgumentException`