Class ProxyUtils

java.lang.Object
com.sap.cds.framework.spring.utils.ProxyUtils

public class ProxyUtils extends Object
  • Method Details

    • createProxy

      public static <T> T createProxy(Class<T> clazz, Supplier<T> supplier)
      Creates a proxy of the given class and redirects method calls to the object returned by the supplier. Both Object.hashCode() and Object.equals(Object) are not forwarded to the object returned by the supplier. These two methods are implemented directly, so that every proxy instance has it's own hash code and is distinct from the actual objects returned by the supplier.
      Type Parameters:
      T - The type of the proxy
      Parameters:
      clazz - The class to proxy
      supplier - The supplier to supply the object to call the method finally on
      Returns:
      the proxy