Class Helpers

java.lang.Object
io.appium.java_client.proxy.Helpers

public class Helpers extends Object
  • Field Details

    • OBJECT_METHOD_NAMES

      public static final Set<String> OBJECT_METHOD_NAMES
  • Method Details

    • createProxy

      public static <T> T createProxy(Class<T> cls, Object[] constructorArgs, Class<?>[] constructorArgTypes, 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(Class<T> cls, Object[] constructorArgs, Class<?>[] constructorArgTypes, Collection<MethodCallListener> listeners, @Nullable net.bytebuddy.matcher.ElementMatcher<net.bytebuddy.description.method.MethodDescription> extraMethodMatcher)
      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. !!! This API is designed for private usage.
      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.
      extraMethodMatcher - Optional additional method proxy conditions
      Returns:
      Proxy instance
    • createProxy

      public static <T> T createProxy(Class<T> cls, 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(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(Class<T> cls, Object[] constructorArgs, 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