下面列出了java.lang.annotation.Inherited#com.sun.tools.javac.model.AnnotationProxyMaker 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("unchecked")
public static ImmutableClassToInstanceMap<Annotation> annotationMap(Symbol symbol) {
ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder();
for (Compound compound : symbol.getAnnotationMirrors()) {
Name qualifiedAnnotationType =
((TypeElement) compound.getAnnotationType().asElement()).getQualifiedName();
try {
Class<? extends Annotation> annotationClazz =
Class.forName(qualifiedAnnotationType.toString()).asSubclass(Annotation.class);
builder.put((Class) annotationClazz,
AnnotationProxyMaker.generateAnnotation(compound, annotationClazz));
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Unrecognized annotation type", e);
}
}
return builder.build();
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
@DefinedBy(Api.LANGUAGE_MODEL)
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
@DefinedBy(Api.LANGUAGE_MODEL)
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
public <A extends Annotation> A getAnnotation(Class<A> annoType) {
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: " + annoType);
Attribute.Compound c = getAttribute(annoType);
return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}