Package jadex.bridge

Class 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 the getProxyClass method or the newProxyInstance 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • useasm

        public static boolean useasm
    • Constructor Detail

      • ProxyFactory

        public ProxyFactory()
    • 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 the getProxyClass method or the newProxyInstance 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 and false otherwise
        Throws:
        java.lang.NullPointerException - if cl is null
      • 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.