如何确定java.lang.class对象是否代表类?
其他Java类型可以通过 isenum(), isannotation(), 。我缺少类型的方法。
How can I determine if a java.lang.Class object represents a class?
Other java types can be determined by methods like isEnum(), isAnnotation(), isInterface(). I'm missing a method for the class type.
我认为这是消除的问题:
if (!c.isEnum() && !c.isInterface() && !c.isArray() && !c.isAnnotation() && !c.isPrimitive()) { // It's a class }
...这不是很令人满意,因为当新功能添加到Java中时,您必须重新访问该定义(例如枚举,注释,...)。
I think it's a matter of elimination:
...which isn't very satisfying, as you have to revisit that definition when new features are added to Java (like enums, annotations, ...).
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
我认为这是消除的问题:
...这不是很令人满意,因为当新功能添加到Java中时,您必须重新访问该定义(例如枚举,注释,...)。
I think it's a matter of elimination:
...which isn't very satisfying, as you have to revisit that definition when new features are added to Java (like enums, annotations, ...).