Package io.appium.java_client.proxy
Interface MethodCallListener
-
- All Known Implementing Classes:
ElementInterceptor,ElementListInterceptor,InterceptorOfAListOfElements,InterceptorOfASingleElement,WidgetInterceptor,WidgetListInterceptor
public interface MethodCallListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.UUIDUNSET
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidafterCall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object result)The callback to be invoked after any public method of the proxy is called.default voidbeforeCall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args)The callback to be invoked before any public method of the proxy is called.default java.lang.Objectcall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.util.concurrent.Callable<?> original)Override this callback in order to change/customize the behavior of a single or multiple methods.default java.lang.ObjectonError(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Throwable e)The callback to be invoked if a public method or itsCallreplacement throws an exception.
-
-
-
Method Detail
-
beforeCall
default void beforeCall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args)The callback to be invoked before any public method of the proxy is called. The implementation is not expected to throw any exceptions. If a runtime exception is thrown then it is going to be silently logged.- Parameters:
obj- The proxy instancemethod- Method to be calledargs- Array of method arguments
-
call
default java.lang.Object call(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.util.concurrent.Callable<?> original) throws java.lang.ThrowableOverride this callback in order to change/customize the behavior of a single or multiple methods. The original method result will be replaced with the result returned by this callback. Also, any exception thrown by it will replace original method(s) exception.- Parameters:
obj- The proxy instancemethod- Method to be replacedargs- Array of method argumentsoriginal- The reference to the original method in case it is necessary to instrument its result.- Returns:
- The type of the returned result should be castable to the returned type of the original method.
- Throws:
java.lang.Throwable
-
afterCall
default void afterCall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object result)The callback to be invoked after any public method of the proxy is called. The implementation is not expected to throw any exceptions. If a runtime exception is thrown then it is going to be silently logged.- Parameters:
obj- The proxy instancemethod- Method to be calledargs- Array of method arguments
-
onError
default java.lang.Object onError(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Throwable e) throws java.lang.ThrowableThe callback to be invoked if a public method or itsCallreplacement throws an exception.- Parameters:
obj- The proxy instancemethod- Method to be calledargs- Array of method argumentse- Exception instance thrown by the original method invocation.- Returns:
- You could either (re)throw the exception in this callback or overwrite the behavior and return a result from it. It is expected that the type of the returned argument could be cast to the returned type of the original method.
- Throws:
java.lang.Throwable
-
-