return (Component) Proxy.newProxyInstance( classloader, new Class[]{ Component.class }, handler );
ArrayList interfaces = new ArrayList(); interfaces.add( Component.class ); if( component instanceof Available ) { interfaces.add( Available.class ); } if( component instanceof Consumer ) { interfaces.add( Consumer.class ); } Class[] classes = (Class[]) interfaces.toArray( new Class[0] ); return (Component) Proxy.newProxyInstance( classloader, classes, handler );
    private Component createComponentReference( Component component )    {        ClassLoader classloader = getClassLoader();        DefaultInvocationHandler handler = new DefaultInvocationHandler( component );        return (Component) Proxy.newProxyInstance( classloader, new Class[]{ Component.class }, handler );    }