类 StandardAnnotationMetadata
- java.lang.Object
- org.springframework.core.type.StandardClassMetadata
- org.springframework.core.type.StandardAnnotationMetadata
- 所有已实现的接口:
AnnotatedTypeMetadata
,AnnotationMetadata
,ClassMetadata
public class StandardAnnotationMetadata extends StandardClassMetadata implements AnnotationMetadata
AnnotationMetadata
implementation that uses standard reflection to introspect a givenClass
.- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller, Mark Fisher, Chris Beams, Phillip Webb, Sam Brannen
构造器概要
构造器 构造器 说明 StandardAnnotationMetadata(Class<?> introspectedClass)
Create a newStandardAnnotationMetadata
wrapper for the given Class.StandardAnnotationMetadata(Class<?> introspectedClass, boolean nestedAnnotationsAsMap)
Create a newStandardAnnotationMetadata
wrapper for the given Class, providing the option to return any nested annotations or annotation arrays in the form ofAnnotationAttributes
instead of actualAnnotation
instances.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 MultiValueMap<String,Object>
getAllAnnotationAttributes(String annotationName)
Retrieve all attributes of all annotations of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation).MultiValueMap<String,Object>
getAllAnnotationAttributes(String annotationName, boolean classValuesAsString)
Retrieve all attributes of all annotations of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation).Set<MethodMetadata>
getAnnotatedMethods(String annotationName)
Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type.Map<String,Object>
getAnnotationAttributes(String annotationName)
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation), also taking attribute overrides on composed annotations into account.Map<String,Object>
getAnnotationAttributes(String annotationName, boolean classValuesAsString)
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation), also taking attribute overrides on composed annotations into account.Set<String>
getAnnotationTypes()
Get the fully qualified class names of all annotation types that are present on the underlying class.Set<String>
getMetaAnnotationTypes(String annotationName)
Get the fully qualified class names of all meta-annotation types that are present on the given annotation type on the underlying class.boolean
hasAnnotatedMethods(String annotationName)
Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type.boolean
hasAnnotation(String annotationName)
Determine whether an annotation of the given type is present on the underlying class.boolean
hasMetaAnnotation(String annotationName)
Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.boolean
isAnnotated(String annotationName)
Determine whether the underlying element has an annotation or meta-annotation of the given type defined.从类继承的方法 org.springframework.core.type.StandardClassMetadata
getClassName, getEnclosingClassName, getInterfaceNames, getIntrospectedClass, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.core.type.ClassMetadata
getClassName, getEnclosingClassName, getInterfaceNames, getMemberClassNames, getSuperClassName, hasEnclosingClass, hasSuperClass, isAbstract, isAnnotation, isConcrete, isFinal, isIndependent, isInterface
构造器详细资料
StandardAnnotationMetadata
public StandardAnnotationMetadata(Class<?> introspectedClass)
Create a newStandardAnnotationMetadata
wrapper for the given Class.- 参数:
introspectedClass
- the Class to introspect- 另请参阅:
StandardAnnotationMetadata(Class, boolean)
StandardAnnotationMetadata
public StandardAnnotationMetadata(Class<?> introspectedClass, boolean nestedAnnotationsAsMap)
Create a newStandardAnnotationMetadata
wrapper for the given Class, providing the option to return any nested annotations or annotation arrays in the form ofAnnotationAttributes
instead of actualAnnotation
instances.- 参数:
introspectedClass
- the Class to introspectnestedAnnotationsAsMap
- return nested annotations and annotation arrays asAnnotationAttributes
for compatibility with ASM-basedAnnotationMetadata
implementations- 从以下版本开始:
- 3.1.1
方法详细资料
getAnnotationTypes
public Set<String> getAnnotationTypes()
从接口复制的说明:AnnotationMetadata
Get the fully qualified class names of all annotation types that are present on the underlying class.- 指定者:
getAnnotationTypes
在接口中AnnotationMetadata
- 返回:
- the annotation type names
getMetaAnnotationTypes
public Set<String> getMetaAnnotationTypes(String annotationName)
从接口复制的说明:AnnotationMetadata
Get the fully qualified class names of all meta-annotation types that are present on the given annotation type on the underlying class.- 指定者:
getMetaAnnotationTypes
在接口中AnnotationMetadata
- 参数:
annotationName
- the fully qualified class name of the meta-annotation type to look for- 返回:
- the meta-annotation type names
hasAnnotation
public boolean hasAnnotation(String annotationName)
从接口复制的说明:AnnotationMetadata
Determine whether an annotation of the given type is present on the underlying class.- 指定者:
hasAnnotation
在接口中AnnotationMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for- 返回:
true
if a matching annotation is present
hasMetaAnnotation
public boolean hasMetaAnnotation(String annotationName)
从接口复制的说明:AnnotationMetadata
Determine whether the underlying class has an annotation that is itself annotated with the meta-annotation of the given type.- 指定者:
hasMetaAnnotation
在接口中AnnotationMetadata
- 参数:
annotationName
- the fully qualified class name of the meta-annotation type to look for- 返回:
true
if a matching meta-annotation is present
isAnnotated
public boolean isAnnotated(String annotationName)
从接口复制的说明:AnnotatedTypeMetadata
Determine whether the underlying element has an annotation or meta-annotation of the given type defined.If this method returns
true
, thenAnnotatedTypeMetadata.getAnnotationAttributes(java.lang.String)
will return a non-null Map.- 指定者:
isAnnotated
在接口中AnnotatedTypeMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for- 返回:
- whether a matching annotation is defined
getAnnotationAttributes
public Map<String,Object> getAnnotationAttributes(String annotationName)
从接口复制的说明:AnnotatedTypeMetadata
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation), also taking attribute overrides on composed annotations into account.- 指定者:
getAnnotationAttributes
在接口中AnnotatedTypeMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for- 返回:
- a Map of attributes, with the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be
null
if no matching annotation is defined.
getAnnotationAttributes
public Map<String,Object> getAnnotationAttributes(String annotationName, boolean classValuesAsString)
从接口复制的说明:AnnotatedTypeMetadata
Retrieve the attributes of the annotation of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation), also taking attribute overrides on composed annotations into account.- 指定者:
getAnnotationAttributes
在接口中AnnotatedTypeMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look forclassValuesAsString
- whether to convert class references to String class names for exposure as values in the returned Map, instead of Class references which might potentially have to be loaded first- 返回:
- a Map of attributes, with the attribute name as key (e.g. "value") and the defined attribute value as Map value. This return value will be
null
if no matching annotation is defined.
getAllAnnotationAttributes
public MultiValueMap<String,Object> getAllAnnotationAttributes(String annotationName)
从接口复制的说明:AnnotatedTypeMetadata
Retrieve all attributes of all annotations of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation). Note that this variant does not take attribute overrides into account.- 指定者:
getAllAnnotationAttributes
在接口中AnnotatedTypeMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for- 返回:
- a MultiMap of attributes, with the attribute name as key (e.g. "value") and a list of the defined attribute values as Map value. This return value will be
null
if no matching annotation is defined. - 另请参阅:
AnnotatedTypeMetadata.getAllAnnotationAttributes(String, boolean)
getAllAnnotationAttributes
public MultiValueMap<String,Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString)
从接口复制的说明:AnnotatedTypeMetadata
Retrieve all attributes of all annotations of the given type, if any (i.e. if defined on the underlying element, as direct annotation or meta-annotation). Note that this variant does not take attribute overrides into account.- 指定者:
getAllAnnotationAttributes
在接口中AnnotatedTypeMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look forclassValuesAsString
- whether to convert class references to String- 返回:
- a MultiMap of attributes, with the attribute name as key (e.g. "value") and a list of the defined attribute values as Map value. This return value will be
null
if no matching annotation is defined. - 另请参阅:
AnnotatedTypeMetadata.getAllAnnotationAttributes(String)
hasAnnotatedMethods
public boolean hasAnnotatedMethods(String annotationName)
从接口复制的说明:AnnotationMetadata
Determine whether the underlying class has any methods that are annotated (or meta-annotated) with the given annotation type.- 指定者:
hasAnnotatedMethods
在接口中AnnotationMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for
getAnnotatedMethods
public Set<MethodMetadata> getAnnotatedMethods(String annotationName)
从接口复制的说明:AnnotationMetadata
Retrieve the method metadata for all methods that are annotated (or meta-annotated) with the given annotation type.For any returned method,
AnnotatedTypeMetadata.isAnnotated(java.lang.String)
will returntrue
for the given annotation type.- 指定者:
getAnnotatedMethods
在接口中AnnotationMetadata
- 参数:
annotationName
- the fully qualified class name of the annotation type to look for- 返回:
- a set of
MethodMetadata
for methods that have a matching annotation. The return value will be an empty set if no methods match the annotation type.