Class Helpers


  • public class Helpers
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T createProxy​(java.lang.Class<T> cls, MethodCallListener listener)
      Creates a transparent proxy instance for the given class.
      static <T> T createProxy​(java.lang.Class<T> cls, java.lang.Object[] constructorArgs, java.lang.Class<?>[] constructorArgTypes, MethodCallListener listener)
      Creates a transparent proxy instance for the given class.
      static <T> T createProxy​(java.lang.Class<T> cls, java.lang.Object[] constructorArgs, java.lang.Class<?>[] constructorArgTypes, java.util.Collection<MethodCallListener> listeners)
      Creates a transparent proxy instance for the given class.
      static <T> T createProxy​(java.lang.Class<T> cls, java.util.Collection<MethodCallListener> listeners)
      Creates a transparent proxy instance for the given class.
      • Methods inherited from class java.lang.Object

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

      • createProxy

        public static <T> T createProxy​(java.lang.Class<T> cls,
                                        java.lang.Object[] constructorArgs,
                                        java.lang.Class<?>[] constructorArgTypes,
                                        java.util.Collection<MethodCallListener> listeners)
        Creates a transparent proxy instance for the given class. It is possible to provide one or more method execution listeners or replace particular method calls completely. Callbacks defined in these listeners are going to be called when any **public** method of the given class is invoked. Overridden callbacks are expected to be skipped if they throw NotImplementedException.
        Type Parameters:
        T - Any class derived from Object
        Parameters:
        cls - the class to which the proxy should be created. Must not be an interface.
        constructorArgs - Array of constructor arguments. Could be an empty array if the class provides a constructor without arguments.
        constructorArgTypes - Array of constructor argument types. Must represent types of constructorArgs.
        listeners - One or more method invocation listeners.
        Returns:
        Proxy instance
      • createProxy

        public static <T> T createProxy​(java.lang.Class<T> cls,
                                        java.util.Collection<MethodCallListener> listeners)
        Creates a transparent proxy instance for the given class. It is possible to provide one or more method execution listeners or replace particular method calls completely. Callbacks defined in these listeners are going to be called when any **public** method of the given class is invoked. Overridden callbacks are expected to be skipped if they throw NotImplementedException.
        Type Parameters:
        T - Any class derived from Object
        Parameters:
        cls - the class to which the proxy should be created. Must not be an interface. Must expose a constructor without arguments.
        listeners - One or more method invocation listeners.
        Returns:
        Proxy instance
      • createProxy

        public static <T> T createProxy​(java.lang.Class<T> cls,
                                        MethodCallListener listener)
        Creates a transparent proxy instance for the given class. It is possible to provide one or more method execution listeners or replace particular method calls completely. Callbacks defined in these listeners are going to be called when any **public** method of the given class is invoked. Overridden callbacks are expected to be skipped if they throw NotImplementedException.
        Type Parameters:
        T - Any class derived from Object
        Parameters:
        cls - the class to which the proxy should be created. Must not be an interface. Must expose a constructor without arguments.
        listener - Method invocation listener.
        Returns:
        Proxy instance
      • createProxy

        public static <T> T createProxy​(java.lang.Class<T> cls,
                                        java.lang.Object[] constructorArgs,
                                        java.lang.Class<?>[] constructorArgTypes,
                                        MethodCallListener listener)
        Creates a transparent proxy instance for the given class. It is possible to provide one or more method execution listeners or replace particular method calls completely. Callbacks defined in these listeners are going to be called when any **public** method of the given class is invoked. Overridden callbacks are expected to be skipped if they throw NotImplementedException.
        Type Parameters:
        T - Any class derived from Object
        Parameters:
        cls - the class to which the proxy should be created. Must not be an interface.
        constructorArgs - Array of constructor arguments. Could be an empty array if the class provides a constructor without arguments.
        constructorArgTypes - Array of constructor argument types. Must represent types of constructorArgs.
        listener - Method invocation listener.
        Returns:
        Proxy instance