Package com.helixframework.proxy
Class ProxyFactory
java.lang.Object
com.helixframework.proxy.ProxyFactory
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 Summary
Modifier and TypeMethodDescriptionstatic <T> Tcreate(Class<T> interfaceClazz, InvocationHandler handler) Creates a dynamic proxy object for the given interface class and invocation handler.static <T> Tcreate(ClassLoader classLoader, Class<T> interfaceClazz, InvocationHandler handler) Creates a dynamic proxy object for the given interface class and invocation handler.
-
Method Details
-
create
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 forhandler- 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 classinterfaceClazz- the interface class to create a proxy forhandler- 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
-