Class BeanResourceHolder
- java.lang.Object
-
- net.cofcool.chaos.server.core.annotation.scanner.BeanResourceHolder
-
public final class BeanResourceHolder extends Object
注解管理。
如果使用@Scanned, 可通过以下方法获取:getAnnotation(Class, Class)getAnnotation(Method, Class)getAnnotation(Method, Class, boolean)。
若未使用@Scanned, 可通过前缀为"find"的方法获取。- Author:
- CofCool
- See Also:
Scanned,AnnotatedElementUtils
-
-
Constructor Summary
Constructors Constructor Description BeanResourceHolder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A extends Annotation>
AfindAnnotation(AnnotatedElement element, Class<A> annotationType, boolean allScope)解析方法或类标注的注解static <T extends Annotation>
TgetAnnotation(Class target, Class<T> annotationType)解析类标注的注解static <T extends Annotation>
TgetAnnotation(Method method, Class<T> annotationType)解析方法标注的注解static <T extends Annotation>
TgetAnnotation(Method method, Class<T> annotationType, boolean allScope)解析方法或类标注的注解
-
-
-
Method Detail
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationType)
解析方法标注的注解- Type Parameters:
T- 注解类型- Parameters:
method- 方法annotationType- 注解类- Returns:
- 注解
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Class target, Class<T> annotationType)
解析类标注的注解- Type Parameters:
T- 注解类型- Parameters:
target- 目标类annotationType- 注解类- Returns:
- 注解
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationType, boolean allScope)
解析方法或类标注的注解- Type Parameters:
T- 注解类型- Parameters:
method- 方法annotationType- 注解类allScope- 是否解析方法和类(如为 true, 解析方法和声明方法的类并按照"方法 > 类"的优先级返回, 如为 false, 只解析方法的注解)- Returns:
- 注解
-
findAnnotation
public static <A extends Annotation> A findAnnotation(AnnotatedElement element, Class<A> annotationType, boolean allScope)
解析方法或类标注的注解- Type Parameters:
A- 注解类型- Parameters:
element- 目标annotationType- 注解类allScope- 是否解析方法和类(如为 true, 解析方法和声明方法的类并按照"方法 > 类"的优先级返回, 如为 false, 只解析方法的注解)- Returns:
- 注解
- See Also:
AnnotatedElementUtils.findMergedAnnotation(AnnotatedElement, Class)
-
-