public static Object createProxy(InvocationHandler handler, Class<?>... itfaces)
  {
    if(handler instanceof ObjectProxy)
    {
      ObjectProxy proxy = (ObjectProxy) handler;
      Class<?> proxyClass = proxy.getProxiedObject().getClass();
      for(Class<?> itface : itfaces)
      {
        if(!ReflectUtils.isSubClassOrInterfaceOf(proxyClass, itface))
          throw new IllegalArgumentException(proxyClass + " does not extend " + itface);
      }
    }

    List<ClassLoader> classLoaders = new ArrayList<ClassLoader>();
    for(Class<?> itface : itfaces)
    {
      classLoaders.add(itface.getClassLoader());
    }

    ClassLoader classLoader = ClassLoaderChain.createChain(classLoaders);

    return Proxy.newProxyInstance(classLoader,
                                  itfaces,
                                  handler);
  }
public static Object createProxy(InvocationHandler handler, Class<?>... itfaces)
  {
    if(handler instanceof ObjectProxy)
    {
      ObjectProxy proxy = (ObjectProxy) handler;
      Class<?> proxyClass = proxy.getProxiedObject().getClass();
      for(Class<?> itface : itfaces)
      {
        if(!ReflectUtils.isSubClassOrInterfaceOf(proxyClass, itface))
          throw new IllegalArgumentException(proxyClass + " does not extend " + itface);
      }
    }

    List<ClassLoader> classLoaders = new ArrayList<ClassLoader>();
    for(Class<?> itface : itfaces)
    {
      classLoaders.add(itface.getClassLoader());
    }

    ClassLoader classLoader = ClassLoaderChain.createChain(classLoaders);

    return Proxy.newProxyInstance(classLoader,
                                  itfaces,
                                  handler);
  }
public static Object createProxy ( InvocationHandler handler , Class < ? > ... itfaces ) { if ( handler instanceof ObjectProxy ) { ObjectProxy proxy = ( ObjectProxy ) handler ; Class < ? > proxyClass = proxy . getProxiedObject ( ) . getClass ( ) ; for ( Class < ? > itface : itfaces ) { if ( ! ReflectUtils . isSubClassOrInterfaceOf ( proxyClass , itface ) ) throw new IllegalArgumentException ( proxyClass + " does not extend " + itface ) ; } } List < ClassLoader > classLoaders = new ArrayList < ClassLoader > ( ) ; for ( Class < ? > itface : itfaces ) { classLoaders . add ( itface . getClassLoader ( ) ) ; } ClassLoader classLoader = ClassLoaderChain . createChain ( classLoaders ) ; return Proxy . newProxyInstance ( classLoader , itfaces , handler ) ; }
Convenient call which creates a proxy using the handler and the interfaces. It will also
check that the object bien proxied (if implements <code>ObjectProxy</code>) properly
implement the right interfaces...

@return the proxy (which implement all the provided interfaces)
Convenient call which creates a proxy using the handler and the interfaces . It will also check that the object bien proxied ( if implements <code > ObjectProxy< / code > ) properly implement the right interfaces ...