private AnnotationType(final Class<?> annoCls) {
if (!annoCls.isAnnotation()) {
throw new IllegalArgumentException("Not an annotation type");
}
Method[] methods = annoCls.getDeclaredMethods();
for (Method m : methods) {
if (m.getParameterTypes().length == 0) {
// cache name -> method assoc
String mname = m.getName();
members.put(mname, m);
// cache member type
Class<?> type = m.getReturnType();
memberTypes.put(mname, invocationHandlerReturnType(type));
// cache member default val (if any)
Object val = m.getDefaultValue();
if (val != null) {
memberDefaults.put(mname, val);
}
} else {
// probably an exception
}
}
if ((annoCls != Retention.class) && (annoCls != Inherited.class)) { // don't get recursive
inherited = annoCls.isAnnotationPresent(Inherited.class);
Retention r = annoCls.getAnnotation(Retention.class);
if (r == null) {
retention = RetentionPolicy.CLASS;
} else {
retention = r.value();
}
}
SharedSecrets.getJavaLangAccess().setAnnotationType(annoCls, this);
}
AnnotationType.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:jpf-core
作者:
评论列表
文章目录