Class ProxyFactory

java.lang.Object
org.seppiko.commons.utils.reflect.ProxyFactory

public class ProxyFactory extends Object
Proxy factory
Author:
Leonard Woo
  • Constructor Details

    • ProxyFactory

      public ProxyFactory()
  • Method Details

    • newInstance

      public static <T> T newInstance(Class<T> clazz, ProxyHandler<T> handler) throws IllegalArgumentException, SecurityException, NullPointerException
      call interface new instance from proxy
      Type Parameters:
      T - interface class type
      Parameters:
      clazz - interface class
      handler - interface method invoke
      Returns:
      interface method invoke return object
      Throws:
      IllegalArgumentException - – if any of the restrictions on the parameters are violated
      SecurityException - – if a security manager, s, is present and any of the following conditions is met: the given loader is null and the caller's class loader is not null and the invocation of s.checkPermission with RuntimePermission("getClassLoader") permission denies access; for each proxy interface, intf, the caller's class loader is not the same as or an ancestor of the class loader for intf and invocation of s.checkPackageAccess() denies access to intf; any of the given proxy interfaces is non-public and the caller class is not in the same runtime package as the non-public interface and the invocation of s.checkPermission with ReflectPermission("newProxyInPackage.{package name}") permission denies access.
      NullPointerException - – if the interfaces array argument or any of its elements are null, or if the invocation handler, h, is null