Http://www.csg.is.titech.ac.jp /~ CHBA/Javassist/
Package COM. vl; import Java. lang. reflect. method; import into sist. classpool; import policsist. ctclass; import into sist. ctmethod; import ipvsist. modifier; import ipvsist. notfoundexception; import ipvsist. bytecode. accessflag; import ipvsist. bytecode. codeattribute; import ipvsist. bytecode. localvariableattribute; import parameter sist. bytecode. methodinfo; import COM. vl. app. PTZ; import COM. vl. app. streamsutil; import COM. vl. SQL. userdao; Public Class Vlinterface { Public Static Void Main (string [] ARGs) throws notfoundexception {classpool pool = classpool. getdefault (); Class [] cs = New Class [] {PTZ. Class , Userdao. Class , Streamsutil. Class }; String [] prefixstrings = New String [] {" PTZ "," User "," Streamsutil "}; For ( Int I = 0; I <CS. length; I ++) {ctclass; Class clz = cs [I]; ctclass = pool. Get (Clz. getname (); method [] Methods = clz. getdeclaredmethods ();For (Method M: Methods) {string name = m. getname (); ctmethod CM = ctclass. getdeclaredmethod (name); methodinfo = cm. getmethodinfo (); Class [] parametertypes = m. getparametertypes (); codeattribute = methodinfo. getcodeattribute (); localvariableattribute ATTR = (localvariableattribute) codeattribute. getattribute (localvariableattribute. tag ); If (ATTR = Null ){ // Exception } If (CM. getmethodinfo (). getaccessflags ()! = Accessflag. Public) Continue ; // System. Out. println (); String [] paramnames =New String [cm. getparametertypes (). Length]; Int Pos = modifier. isstatic (CM. getmodifiers ())? 0: 1; For ( Int J = 0; j <paramnames. length; j ++) paramnames [J] = ATTR. variablename (J + POS ); // Paramnames is the parameter name System. Out . Printf (" \ "% S. % s \": \ r \ n \ treturn: % s \ t (Parameters ", Prefixstrings [I], name, M. getreturntype (). getsimplename ()); For ( Int I1 = 0; I1 <paramnames. length; I1 ++) {system.Out . Printf (" % D: [% S % s] ", I1 + 1, parametertypes [I1]. getsimplename (), paramnames [I1]);} // For (class class1: parametertypes ){ // System. Out. printf ("[% s],", class1.getname ()); //} System. Out . Println (" ) \ R \ n ");}}}}