public class RecoverAnnotationRecoveryHandler<T> extends Object implements MethodInvocationRecoverer<T>
@Recover
annotation. A
suitable recovery method is one with a Throwable type as the first parameter and the
same return type and arguments as the method that failed. The Throwable first argument
is optional and if omitted the method is treated as a default (called when there are no
other matches). Generally the best matching method is chosen based on the type of the
first parameter and the type of the exception being handled. The closest match in the
class hierarchy is chosen, so for instance if an IllegalArgumentException is being
handled and there is a method whose first argument is RuntimeException, then it will be
preferred over a method whose first argument is Throwable.Constructor and Description |
---|
RecoverAnnotationRecoveryHandler(Object target,
Method method) |
Modifier and Type | Method and Description |
---|---|
T |
recover(Object[] args,
Throwable cause)
Recover gracefully from an error.
|
public T recover(Object[] args, Throwable cause)
MethodInvocationRecoverer
recover
in interface MethodInvocationRecoverer<T>
args
- the arguments for the method invocation that failed.cause
- the cause of the failure that led to this recovery.Copyright © 2018 SpringSource. All rights reserved.