Maybe I'm missing something, but Class is a final class. Quoting Mike Jackson <[EMAIL PROTECTED]>:
> Perhaps you ought to post a snippet of what doesn't work. I personally > haven't had any problems with "instanceof", but without seeing what you're > doing I don't think any of us can help. > > --mikej > -=----- > mike jackson > [EMAIL PROTECTED] > > > -----Original Message----- > > From: Felipe Schnack [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, February 20, 2003 11:01 AM > > To: Tomcat Users List > > Subject: instance of (ot) > > > > > > I would like to use instanceof's keyword funcionality. > > The problem is that I want to test if a class is subclass of a > > java.lang.Class object... There is a way? Instanceof keyword doesn't > > work, so I implemented the following, but I'm not very proud of myself: > > > > private boolean instanceOf(Object obj, Class clasz) > > { > > if (obj == null || clasz == null) return false; > > Class objClass = obj.getClass(); > > Class[] classes = objClass.getClasses(); > > if (classes == null) return false; > > for (int i = 0; i<classes.length; i++) > > { > > if (classes[i].equals(clasz)) return true; > > } > > while (objClass != null) > > { > > if (objClass.equals(clasz)) return true; > > objClass = objClass.getSuperclass(); > > } > > return false; > > } > > > > > > -- > > > > Felipe Schnack > > Analista de Sistemas > > [EMAIL PROTECTED] > > Cel.: (51)91287530 > > Linux Counter #281893 > > > > Centro Universitário Ritter dos Reis > > http://www.ritterdosreis.br > > [EMAIL PROTECTED] > > Fone/Fax.: (51)32303341 > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]