Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我正在写一个 AnnotationProcessor 并且在 process 方法中给你一个TypeElement。我需要检查 TypeElement 是接口还是类。我该怎么做呢?
我完全错过了 JavaDoc 中的答案。
它的
TypeElement.getKind() == ElementKind.INTERFACE
或者
TypeElement.getKind().isInterface()