Class ProxyFactory
java.lang.Object
org.seppiko.commons.utils.reflect.ProxyFactory
public class ProxyFactory
extends java.lang.Object
Proxy factory
- Author:
- Leonard Woo
-
Constructor Summary
Constructors Constructor Description ProxyFactory() -
Method Summary
Modifier and Type Method Description static <T> TnewInstance(java.lang.Class<T> clazz, ProxyHandler<T> handler)call interface new instance from proxyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ProxyFactory
public ProxyFactory()
-
-
Method Details
-
newInstance
public static <T> T newInstance(java.lang.Class<T> clazz, ProxyHandler<T> handler) throws java.lang.IllegalArgumentException, java.lang.SecurityException, java.lang.NullPointerExceptioncall interface new instance from proxy- Type Parameters:
T- interface class type- Parameters:
clazz- interface classhandler- interface method invoke- Returns:
- interface method invoke return object
- Throws:
java.lang.IllegalArgumentException- – if any of the restrictions on the parameters are violatedjava.lang.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.java.lang.NullPointerException- – if the interfaces array argument or any of its elements are null, or if the invocation handler, h, is null
-