Package jadex.bridge
Class ProxyFactory
- java.lang.Object
-
- jadex.bridge.ProxyFactory
-
public class ProxyFactory extends java.lang.Object
Create a proxy with standard Java or per Jadex ASM.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
useasm
-
Constructor Summary
Constructors Constructor Description ProxyFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.reflect.InvocationHandler
getInvocationHandler(java.lang.Object proxy)
Get the invocation handler of a proxy.static boolean
isASMProxyClass(java.lang.Class<?> cl)
Test if it is a ASM proxy class.static boolean
isProxyClass(java.lang.Class<?> cl)
Returns true if and only if the specified class was dynamically generated to be a proxy class using thegetProxyClass
method or thenewProxyInstance
method.static java.lang.Object
newProxyInstance(java.lang.ClassLoader loader, java.lang.Class<?>[] interfaces, java.lang.reflect.InvocationHandler h)
Returns an instance of a proxy class for the specified interfaces that dispatches method invocations to the specified invocation handler.
-
-
-
Method Detail
-
newProxyInstance
public static java.lang.Object newProxyInstance(java.lang.ClassLoader loader, java.lang.Class<?>[] interfaces, java.lang.reflect.InvocationHandler h)
Returns an instance of a proxy class for the specified interfaces that dispatches method invocations to the specified invocation handler.
-
getInvocationHandler
public static java.lang.reflect.InvocationHandler getInvocationHandler(java.lang.Object proxy) throws java.lang.IllegalArgumentException
Get the invocation handler of a proxy.- Parameters:
proxy
-- Returns:
- The handler
- Throws:
java.lang.IllegalArgumentException
-
isProxyClass
public static boolean isProxyClass(java.lang.Class<?> cl)
Returns true if and only if the specified class was dynamically generated to be a proxy class using thegetProxyClass
method or thenewProxyInstance
method.The reliability of this method is important for the ability to use it to make security decisions, so its implementation should not just test if the class in question extends
Proxy
.- Parameters:
cl
- the class to test- Returns:
true
if the class is a proxy class andfalse
otherwise- Throws:
java.lang.NullPointerException
- ifcl
isnull
-
isASMProxyClass
public static boolean isASMProxyClass(java.lang.Class<?> cl)
Test if it is a ASM proxy class.- Parameters:
cl
- The class.- Returns:
- True, if is asm proxy class.
-
-