@SuppressWarnings("unchecked")
  public static <T> T createProxy(InvocationHandler handler, Class<T> itface) {
    """
	Convenient call which creates a proxy using the handler and the interface. It will also
	check that the object bien proxied (if implements <code>ObjectProxy</code>) properly
	implement the interface...
	
	@return the proxy (which implement all the interface)
    """
    if(handler instanceof ObjectProxy)
    {
      ObjectProxy proxy = (ObjectProxy) handler;
      if(!ReflectUtils.isSubClassOrInterfaceOf(proxy.getProxiedObject().getClass(), itface))
        throw new IllegalArgumentException(proxy.getProxiedObject().getClass() + " does not extend " + itface);
    }

    return (T) Proxy.newProxyInstance(itface.getClassLoader(),
                                      new Class<?>[] {itface},
                                      handler);
  }
@SuppressWarnings("unchecked")
  public static <T> T createProxy(InvocationHandler handler, Class<T> itface)
  {
    if(handler instanceof ObjectProxy)
    {
      ObjectProxy proxy = (ObjectProxy) handler;
      if(!ReflectUtils.isSubClassOrInterfaceOf(proxy.getProxiedObject().getClass(), itface))
        throw new IllegalArgumentException(proxy.getProxiedObject().getClass() + " does not extend " + itface);
    }

    return (T) Proxy.newProxyInstance(itface.getClassLoader(),
                                      new Class<?>[] {itface},
                                      handler);
  }
@ SuppressWarnings ( "unchecked" ) public static < T > T createProxy ( InvocationHandler handler , Class < T > itface ) { if ( handler instanceof ObjectProxy ) { ObjectProxy proxy = ( ObjectProxy ) handler ; if ( ! ReflectUtils . isSubClassOrInterfaceOf ( proxy . getProxiedObject ( ) . getClass ( ) , itface ) ) throw new IllegalArgumentException ( proxy . getProxiedObject ( ) . getClass ( ) + " does not extend " + itface ) ; } return ( T ) Proxy . newProxyInstance ( itface . getClassLoader ( ) , new Class < ? > [ ] { itface } , handler ) ; }
Convenient call which creates a proxy using the handler and the interface. It will also
check that the object bien proxied (if implements <code>ObjectProxy</code>) properly
implement the interface...

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