Class 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
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Iterable<java.lang.annotation.Annotation> annotations()
      Deprecated.
      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.
      AnnotationMap getAllAnnotations()
      NOTE: promoted in 2.9 from `Annotated` up
      <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.
      java.lang.String getFullName()  
      abstract java.lang.reflect.Member getMember()  
      TypeResolutionContext getTypeContext()
      Deprecated.
      Since 2.9
      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.
      abstract Annotated withAnnotations​(AnnotationMap fallback)
      Fluent factory method that will construct a new instance that uses specified instance annotations instead of currently configured ones.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • withAnnotations

        public abstract Annotated withAnnotations​(AnnotationMap fallback)
        Fluent factory method that will construct a new instance that uses specified instance annotations instead of currently configured ones.
        Since:
        2.9 (promoted from `Annotated`)
      • getDeclaringClass

        public abstract java.lang.Class<?> getDeclaringClass()
        Actual physical class in which this memmber was declared.
      • getMember

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

        public java.lang.String getFullName()
      • 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

        @Deprecated
        public java.lang.Iterable<java.lang.annotation.Annotation> annotations()
        Deprecated.
        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

        public AnnotationMap getAllAnnotations()

        NOTE: promoted in 2.9 from `Annotated` up

      • 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
      • 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