Annotation Type Fallback
-
@Documented @Retention(RUNTIME) @Target(METHOD) @Inherited @InterceptorBinding public @interface Fallback
The fallback annotation to define the fallback handler class so that a failure can be handled properly. Below is the criteria:- If value is specified, use
FallbackHandler.handle(ExecutionContext)
on the specified handler to execute the fallback. - If fallbackMethod is specified, invoke the method specified by the fallbackMethod on the same class.
- If both are specified, the
FaultToleranceDefinitionException
must be thrown.
- If value is specified, use
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String
fallbackMethod
Specify the method name to be fallbacked to.java.lang.Class<? extends FallbackHandler<?>>
value
Specify the fallback class to be used.
-
-
-
Element Detail
-
value
java.lang.Class<? extends FallbackHandler<?>> value
Specify the fallback class to be used. An new instance of the fallback class is returned. The instance is unmanaged. The type parameter of the fallback class must be assignable to the return type of the annotated method. Otherwise,FaultToleranceDefinitionException
occurs.- Returns:
- the fallback class
- Default:
- org.eclipse.microprofile.faulttolerance.Fallback.DEFAULT.class
-
-
-
fallbackMethod
java.lang.String fallbackMethod
Specify the method name to be fallbacked to. This method belongs to the same class as the method to fallback. The method must have the exactly same arguments as the method being annotated. The method return type must be assignable to the return type of the method the fallback is for. Otherwise,FaultToleranceDefinitionException
must be thrown.- Returns:
- the local method to fallback to
- Default:
- ""
-
-