I want to be able to check if an object is an instance or a subclass of a specified class - where that class is specified in a string that is only known at runtime. For example to have the following code print out "bobs got a date":
boolean isInstanceof(Object o, String klass) { //TODO } java.sql.Timestamp bob = new java.sql.Timestamp(0); if( isInstanceof( bob, "java.util.Date" ) ) { System.out.println("bobs got a date"); } One idea that occured to me was to get the classname of bob, and test against the string, and if that didnt match, to get the classname of that classes superclass ( and test that and so on, but Im wondering if there exists a more efficient technique... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]