/** Is this an applet? * @return <code>true</code> if this class is a <code>java.applet.Applet</code> * @deprecated This method probably should not be used, as it catches a variety of potentially * serious exceptions and errors, and swallows them so as to produce a simple boolean * result. (Notifying them all would be inappropriate as they typically come from user * code.) Better to directly parse the bytecode, using e.g. the classfile module, * which is immune to this class of errors. */ public boolean isApplet () { if (applet != null) return applet.booleanValue (); boolean b = instanceOf (java.applet.Applet.class); applet = b ? Boolean.TRUE : Boolean.FALSE; return b; }
/** Uses the cache to answer this question without loading the class itself, if the * cache exists. */ public boolean instanceOf (Class type) { // try the life object if any FileObject fo = entry ().getFile (); if (fo.lastModified ().getTime () <= saveTime) { Object o = bean.get (); if (o != null) { return type.isInstance (o); } } // else do checking of classes // null means no cache exists Boolean res = inListOfClasses (type, entry ().getFile ()); if (res == null) { // uses instanceClass and then assignableFrom return super.instanceOf (type); } return res.booleanValue (); }