Class AnnotatedClass
- java.lang.Object
-
- org.codehaus.jackson.map.introspect.Annotated
-
- org.codehaus.jackson.map.introspect.AnnotatedClass
-
public final class AnnotatedClass extends Annotated
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationIntrospector_annotationIntrospectorFilter used to determine which annotations to gather; used to optimize things so that unnecessary annotations are ignored.protected java.lang.Class<?>_classClass for which annotations apply, and that owns other components (constructors, methods)protected AnnotationMap_classAnnotationsCombined list of Jackson annotations that the class has, including inheritable ones from super classes and interfacesprotected java.util.List<AnnotatedConstructor>_constructorsSingle argument constructors the class has, if any.protected java.util.List<AnnotatedMethod>_creatorMethodsSingle argument static methods that might be usable as factory methodsprotected AnnotatedConstructor_defaultConstructorDefault constructor of the annotated class, if it has one.protected java.util.List<AnnotatedField>_fieldsMember fields of interest: ones that are either public, or have at least one annotation.protected AnnotatedMethodMap_memberMethodsMember methods of interest; for now ones with 0 or 1 arguments (just optimization, since others won't be used now)protected ClassIntrospector.MixInResolver_mixInResolverObject 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<?>_primaryMixInPrimary mix-in class; one to use for the annotated class itself.protected java.util.List<java.lang.Class<?>>_superTypesOrdered set of super classes and interfaces of the class itself: included in order of precedence
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void_addClassMixIns(AnnotationMap annotations, java.lang.Class<?> toMask)Helper method for adding any mix-in annotations specified class might have.protected void_addClassMixIns(AnnotationMap annotations, java.lang.Class<?> toMask, java.lang.Class<?> mixin)protected void_addConstructorMixIns(java.lang.Class<?> mixin)protected void_addFactoryMixIns(java.lang.Class<?> mixin)protected void_addFieldMixIns(java.lang.Class<?> targetClass, java.lang.Class<?> mixInCls, 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_addFields(java.util.Map<java.lang.String,AnnotatedField> fields, java.lang.Class<?> c)protected void_addMemberMethods(java.lang.Class<?> cls, MethodFilter methodFilter, AnnotatedMethodMap methods, java.lang.Class<?> mixInCls, AnnotatedMethodMap mixIns)protected void_addMethodMixIns(java.lang.Class<?> targetClass, MethodFilter methodFilter, 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 AnnotatedConstructor_constructConstructor(java.lang.reflect.Constructor<?> ctor, boolean defaultCtor)protected AnnotatedMethod_constructCreatorMethod(java.lang.reflect.Method m)protected AnnotatedField_constructField(java.lang.reflect.Field f)protected AnnotatedMethod_constructMethod(java.lang.reflect.Method m)protected boolean_isIncludableMethod(java.lang.reflect.Method m, MethodFilter filter)static AnnotatedClassconstruct(java.lang.Class<?> cls, AnnotationIntrospector aintr, ClassIntrospector.MixInResolver mir)Factory method that instantiates an instance.static AnnotatedClassconstructWithoutSuperTypes(java.lang.Class<?> cls, AnnotationIntrospector aintr, ClassIntrospector.MixInResolver mir)Method similar toconstruct(java.lang.Class<?>, org.codehaus.jackson.map.AnnotationIntrospector, org.codehaus.jackson.map.ClassIntrospector.MixInResolver), but that will NOT include information from supertypes; only class itself and any direct mix-ins it may have.java.lang.Iterable<AnnotatedField>fields()AnnotatedMethodfindMethod(java.lang.String name, java.lang.Class<?>[] paramTypes)protected AnnotationMapgetAllAnnotations()java.lang.Class<?>getAnnotated()Method that can be used to find actual JDK element that this instance represents.<A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> acls)AnnotationsgetAnnotations()java.util.List<AnnotatedConstructor>getConstructors()AnnotatedConstructorgetDefaultConstructor()intgetFieldCount()java.lang.reflect.TypegetGenericType()Full generic type of the annotated element; definition of what exactly this means depends on sub-class.intgetMemberMethodCount()intgetModifiers()java.lang.StringgetName()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()booleanhasAnnotations()java.lang.Iterable<AnnotatedMethod>memberMethods()voidresolveClassAnnotations()Initialization method that will recursively collect Jackson annotations for this class and all super classes and interfaces.voidresolveCreators(boolean includeAll)Initialization method that will find out all constructors and potential static factory methods the class has.voidresolveFields()Method that will collect all member (non-static) fields that are either public, or have at least a single annotation associated with them.voidresolveFields(boolean collectIgnored)Deprecated.voidresolveMemberMethods(MethodFilter methodFilter)Method for resolving member method information: aggregating all non-static methods and combining annotations (to implement method-annotation inheritance)voidresolveMemberMethods(MethodFilter methodFilter, boolean collectIgnored)Deprecated.java.lang.StringtoString()AnnotatedClasswithAnnotations(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 org.codehaus.jackson.map.introspect.Annotated
getType, hasAnnotation, isPublic, withFallBackAnnotationsFrom
-
-
-
-
Field Detail
-
_class
protected final java.lang.Class<?> _class
Class for which annotations apply, and that owns other components (constructors, methods)
-
_superTypes
protected final java.util.List<java.lang.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 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
-
_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:AnnotatedFluent factory method that will construct a new instance that uses specified instance annotations instead of currently configured ones.- Specified by:
withAnnotationsin classAnnotated
-
construct
public static AnnotatedClass construct(java.lang.Class<?> cls, AnnotationIntrospector aintr, ClassIntrospector.MixInResolver mir)
Factory method that instantiates an instance. Returned instance will only be initialized with class annotations, but not with any method information.
-
constructWithoutSuperTypes
public static AnnotatedClass constructWithoutSuperTypes(java.lang.Class<?> cls, AnnotationIntrospector aintr, ClassIntrospector.MixInResolver mir)
Method similar toconstruct(java.lang.Class<?>, org.codehaus.jackson.map.AnnotationIntrospector, org.codehaus.jackson.map.ClassIntrospector.MixInResolver), but that will NOT include information from supertypes; only class itself and any direct mix-ins it may have.
-
getAnnotated
public java.lang.Class<?> getAnnotated()
Description copied from class:AnnotatedMethod 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:
getAnnotatedin classAnnotated
-
getModifiers
public int getModifiers()
- Specified by:
getModifiersin classAnnotated
-
getAnnotation
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)
- Specified by:
getAnnotationin classAnnotated
-
getGenericType
public java.lang.reflect.Type getGenericType()
Description copied from class:AnnotatedFull generic type of the annotated element; definition of what exactly this means depends on sub-class.- Specified by:
getGenericTypein classAnnotated
-
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:
getRawTypein classAnnotated
-
getAllAnnotations
protected AnnotationMap getAllAnnotations()
- Specified by:
getAllAnnotationsin classAnnotated
-
getAnnotations
public Annotations getAnnotations()
- Returns:
- 1.7
-
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()
-
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, java.lang.Class<?> toMask)
Helper method for adding any mix-in annotations specified class might have.
-
_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, MethodFilter methodFilter, AnnotatedMethodMap methods, java.lang.Class<?> mixInCls, AnnotatedMethodMap mixIns)
-
_addMethodMixIns
protected void _addMethodMixIns(java.lang.Class<?> targetClass, MethodFilter methodFilter, AnnotatedMethodMap methods, java.lang.Class<?> mixInCls, AnnotatedMethodMap mixIns)
-
_addFields
protected void _addFields(java.util.Map<java.lang.String,AnnotatedField> fields, java.lang.Class<?> c)
-
_addFieldMixIns
protected void _addFieldMixIns(java.lang.Class<?> targetClass, java.lang.Class<?> mixInCls, 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)
-
_constructConstructor
protected AnnotatedConstructor _constructConstructor(java.lang.reflect.Constructor<?> ctor, boolean defaultCtor)
-
_constructCreatorMethod
protected AnnotatedMethod _constructCreatorMethod(java.lang.reflect.Method m)
-
_constructField
protected AnnotatedField _constructField(java.lang.reflect.Field f)
-
_collectRelevantAnnotations
protected AnnotationMap[] _collectRelevantAnnotations(java.lang.annotation.Annotation[][] anns)
-
_collectRelevantAnnotations
protected AnnotationMap _collectRelevantAnnotations(java.lang.annotation.Annotation[] anns)
-
_isIncludableMethod
protected boolean _isIncludableMethod(java.lang.reflect.Method m, MethodFilter filter)
-
_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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-