public Set<ElementType> getAnnotationTargets(JvmAnnotationType annotation) {
EList<JvmAnnotationReference> annotations = annotation.getAnnotations();
for (JvmAnnotationReference annoRef : annotations) {
if (Target.class.getName().equals(annoRef.getAnnotation().getIdentifier())) {
EList<JvmAnnotationValue> values = annoRef.getValues();
JvmAnnotationValue value = values.isEmpty() ? null : values.get(0);
if (value instanceof JvmEnumAnnotationValue) {
Set<ElementType> result = newHashSet();
for (JvmEnumerationLiteral elementType : ((JvmEnumAnnotationValue) value).getValues()) {
final String simpleName = elementType.getSimpleName();
result.add(ElementType.valueOf(simpleName));
}
return result;
}
}
}
return emptySet();
}
XAnnotationUtil.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:xtext-extras
作者:
评论列表
文章目录