org.linkedin.util-core/src/main/java/org/linkedin/util/reflect/ObjectProxyInvocationHandler.java
@SuppressWarnings("unchecked")
  public static <T> T createProxy(Class<T> interfaceToProxy, T objectToProxy)
  {
    // since there is only one interface in the array, we know that the proxy must implement it!
    return (T) Proxy.newProxyInstance(interfaceToProxy.getClassLoader(),
                                      new Class<?>[] {interfaceToProxy},
                                      new ObjectProxyInvocationHandler(objectToProxy));
  }
@SuppressWarnings("unchecked")
  public static <T> T createProxy(Class<T> interfaceToProxy, T objectToProxy)
  {
    // since there is only one interface in the array, we know that the proxy must implement it!
    return (T) Proxy.newProxyInstance(interfaceToProxy.getClassLoader(),
                                      new Class<?>[] {interfaceToProxy},
                                      new ObjectProxyInvocationHandler(objectToProxy));
  }
This is a convenient call when you want to proxy an object with the unique given
interface. Note that you can use the more general call {@link Proxy#newProxyInstance(ClassLoader, Class[], InvocationHandler)}
if you want to do something different.

@param interfaceToProxy the interface to proxy
@param objectToProxy the object to proxy (note that it must implement interfaceToProxy!)
@return the proxied object