Determining if a java.lang.Class object implements Comparable

If I have a Class clazz object, is it possible to determine if it implements Comparable without calling newInstance() against it?

This is the code I currently have, but I'd like to do the same thing without creating a variable that will immediately be thrown away.

privateboolean implementsComparable(Class clazz)

{

try

{

if (clazz.newInstance()instanceof Comparable)

{

returntrue;

}

}

catch (Exception ex)

{

// @TODO something about NPE's

// ignore all exceptions here

}

returnfalse;

}

Thank you.

[1218 byte] By [cvweiss__a] at [2007-11-27 6:37:18]
# 1
boolean itsComparable = Comparable.class.isAssignableFrom(yourClassHere);
georgemca at 2007-7-12 18:05:39 > top of Java-index,Java Essentials,Java Programming...
# 2
Thank you.
cvweiss__a at 2007-7-12 18:05:39 > top of Java-index,Java Essentials,Java Programming...