在Java中获取注释的字段

时间:2015-07-14 19:23:30

标签: java annotations annotation-processing

这是在注释处理中。 我有一个TypeElement,我知道它是用@Bind注释的。 我得到了TypeElement:

ProcessingEnvironment#getElementsAnnotatedWith(Bind.class)

@Bind看起来像这样:

public @interface Bind {
    Class<? extends Stuff>[] stuffArray();
}

我可以这样做:

typeElement.getAnnotation(Bind.class);

但是我不能这样做,因为它会导致MirroredTypesException:

typeElement.getAnnotation(Bind.class).stuffArray();

我如何获得该阵列?

0 个答案:

没有答案