java.lang.Object
org.seppiko.commons.utils.reflect.ProxyFactory
Proxy factory
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
newInstance
(Class<T> clazz, ProxyHandler<T> handler) call interface new instance from proxy
-
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 classhandler
- interface method invoke- Returns:
- interface method invoke return object
- Throws:
IllegalArgumentException
- – if any of the restrictions on the parameters are violatedSecurityException
- – 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
-