protected Class resolveProxyClass ( String [ ] interfaces ) throws IOException , ClassNotFoundException { ClassLoader cl = getClass ( ) . getClassLoader ( ) ; Class [ ] cinterfaces = new Class [ interfaces . length ] ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { try { cinterfaces [ i ] = cl . loadClass ( interfaces [ i ] ) ; } catch ( ClassNotFoundException ex ) { ClassLoader tccl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( tccl != null ) { return tccl . loadClass ( interfaces [ i ] ) ; } else { throw ex ; } } } try { return Proxy . getProxyClass ( cinterfaces [ 0 ] . getClassLoader ( ) , cinterfaces ) ; } catch ( IllegalArgumentException e ) { throw new ClassNotFoundException ( null , e ) ; } }
Returns a proxy class that implements the interfaces named in a proxy class descriptor ; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes allowing them to use an alternate loading mechanism for the interfaces and the proxy class .