Package io.appium.java_client.proxy
Interface MethodCallListener
- All Known Subinterfaces:
ProxyAwareListener
- All Known Implementing Classes:
ElementAwareWebDriverListener,ElementInterceptor,ElementListInterceptor,InterceptorOfAListOfElements,InterceptorOfASingleElement,WidgetInterceptor,WidgetListInterceptor
public interface MethodCallListener
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidThe callback to be invoked after any public method of the proxy is called.default voidbeforeCall(Object obj, Method method, Object[] args) The callback to be invoked before any public method of the proxy is called.default ObjectOverride this callback in order to change/customize the behavior of a single or multiple methods.default ObjectThe callback to be invoked if a public method or itsCallreplacement throws an exception.
-
Field Details
-
UNSET
-
-
Method Details
-
beforeCall
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 Object call(Object obj, Method method, Object[] args, Callable<?> original) throws Throwable Override 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:
Throwable
-
afterCall
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
The 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:
Throwable
-