package org.gcube.common.clients.stubs.jaxws.proxies; import java.lang.reflect.Proxy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class GenericProxyFactory { public static Logger log = LoggerFactory.getLogger(MethodRetriever.class); @SuppressWarnings("unchecked") public static T getProxy(Class intf, String endpointAddress, final I obj) { T proxy = (T) Proxy.newProxyInstance(obj.getClass().getClassLoader(), new Class[] { intf }, new MethodRetriever(obj)); log.debug("for interface "+intf.getCanonicalName()+" the proxy class is "+proxy.getClass().getCanonicalName()); return proxy; } }