Class AnnotatedClass


  • public final class AnnotatedClass
    extends Annotated
    • Field Detail

      • _class

        protected final Class<?> _class
        Class for which annotations apply, and that owns other components (constructors, methods)
      • _superTypes

        protected final List<Class<?>> _superTypes
        Ordered set of super classes and interfaces of the class itself: included in order of precedence
      • _annotationIntrospector

        protected final AnnotationIntrospector _annotationIntrospector
        Filter used to determine which annotations to gather; used to optimize things so that unnecessary annotations are ignored.
      • _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 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
      • _defaultConstructor

        protected AnnotatedConstructor _defaultConstructor
        Default constructor of the annotated class, if it has one.
      • _creatorMethods

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

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

        public Type getGenericType()
        Description copied from class: Annotated
        Full generic type of the annotated element; definition of what exactly this means depends on sub-class.
        Specified by:
        getGenericType in class Annotated
      • getRawType

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

        public Annotations getAnnotations()
        Returns:
        1.7
      • hasAnnotations

        public boolean hasAnnotations()
      • getMemberMethodCount

        public int getMemberMethodCount()
      • getFieldCount

        public int getFieldCount()
      • resolveClassAnnotations

        public void resolveClassAnnotations()
        Initialization method that will recursively collect Jackson annotations for this class and all super classes and interfaces.

        Starting with 1.2, it will also apply mix-in annotations, as per [JACKSON-76]

      • resolveCreators

        public void resolveCreators​(boolean includeAll)
        Initialization method that will find out all constructors and potential static factory methods the class has.

        Starting with 1.2, it will also apply mix-in annotations, as per [JACKSON-76]

        Parameters:
        includeAll - If true, includes all creator methods; if false, will only include the no-arguments "default" constructor
      • resolveMemberMethods

        public void resolveMemberMethods​(MethodFilter methodFilter)
        Method for resolving member method information: aggregating all non-static methods and combining annotations (to implement method-annotation inheritance)
        Parameters:
        methodFilter - Filter used to determine which methods to include
        Since:
        1.9
      • resolveFields

        public void resolveFields()
        Method that will collect all member (non-static) fields that are either public, or have at least a single annotation associated with them.
        Since:
        1.9
      • resolveMemberMethods

        @Deprecated
        public void resolveMemberMethods​(MethodFilter methodFilter,
                                         boolean collectIgnored)
        Deprecated.
        Since:
        1.9 Use version without arguments
      • resolveFields

        @Deprecated
        public void resolveFields​(boolean collectIgnored)
        Deprecated.
        Since:
        1.9 Use version without arguments
      • _addClassMixIns

        protected void _addClassMixIns​(AnnotationMap annotations,
                                       Class<?> toMask)
        Helper method for adding any mix-in annotations specified class might have.
      • _addClassMixIns

        protected void _addClassMixIns​(AnnotationMap annotations,
                                       Class<?> toMask,
                                       Class<?> mixin)
      • _addConstructorMixIns

        protected void _addConstructorMixIns​(Class<?> mixin)
      • _addFactoryMixIns

        protected void _addFactoryMixIns​(Class<?> mixin)
      • _addFieldMixIns

        protected void _addFieldMixIns​(Class<?> mixin,
                                       Map<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)
      • _isIncludableMethod

        protected boolean _isIncludableMethod​(Method m,
                                              MethodFilter filter)
      • _addMixOvers

        protected void _addMixOvers​(Constructor<?> mixin,
                                    AnnotatedConstructor target,
                                    boolean addParamAnnotations)
        Parameters:
        addParamAnnotations - Whether parameter annotations are to be added as well
      • _addMixOvers

        protected void _addMixOvers​(Method mixin,
                                    AnnotatedMethod target,
                                    boolean addParamAnnotations)
        Parameters:
        addParamAnnotations - Whether parameter annotations are to be added as well
      • _addMixUnders

        protected void _addMixUnders​(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.