Class ProxyFactory

java.lang.Object
com.helixframework.proxy.ProxyFactory

public final class ProxyFactory extends Object
The ProxyFactory class is a utility class for creating dynamic proxy objects. It provides methods to create proxies for interfaces, given the interface class and an invocation handler.
  • Method Details

    • create

      public static <T> T create(Class<T> interfaceClazz, InvocationHandler handler)
      Creates a dynamic proxy object for the given interface class and invocation handler.
      Type Parameters:
      T - the type of the interface class
      Parameters:
      interfaceClazz - the interface class to create a proxy for
      handler - the invocation handler to handle method invocations on the proxy object
      Returns:
      a dynamic proxy object that implements the given interface
      Throws:
      IllegalArgumentException - if the provided interface class is not an interface
    • create

      public static <T> T create(ClassLoader classLoader, Class<T> interfaceClazz, InvocationHandler handler)
      Creates a dynamic proxy object for the given interface class and invocation handler.
      Type Parameters:
      T - the type of the interface class
      Parameters:
      classLoader - the class loader to define the proxy class
      interfaceClazz - the interface class to create a proxy for
      handler - the invocation handler to handle method invocations on the proxy object
      Returns:
      a dynamic proxy object that implements the given interface
      Throws:
      IllegalArgumentException - if the provided interface class is not an interface