Class FaultToleranceUtils
- java.lang.Object
-
- fish.payara.microprofile.faulttolerance.service.FaultToleranceUtils
-
public class FaultToleranceUtils extends Object
Utility Methods for the Fault Tolerance Interceptors.- Author:
- Andrew Pielage, Jan Bernitt (2.0)
-
-
Constructor Summary
Constructors Constructor Description FaultToleranceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A extends Annotation>
Class<?>getAnnotatedMethodClass(jakarta.interceptor.InvocationContext context, Class<A> annotationClass)Returns either the CDI Proxy class (for cases where a class extends another without overriding the target method), or the actual declaring class if the annotation isn't present on the proxy class.static <A extends Annotation>
AgetAnnotation(Stereotypes sterotypes, Class<A> annotationClass, jakarta.interceptor.InvocationContext context)Gets the annotation from the method that triggered the interceptor.static StringgetCanonicalMethodName(jakarta.interceptor.InvocationContext context)Gets the full method signature from an invocation context, stripping out any Weld proxy name gubbins.static <A extends Annotation>
booleangetEnabledOverrideValue(org.eclipse.microprofile.config.Config config, Class<A> annotationType, jakarta.interceptor.InvocationContext context, boolean defaultValue)Gets overriding config enabled parameter value if it's present from an invocation context.static <A extends Annotation,T>
TgetOverrideValue(org.eclipse.microprofile.config.Config config, Class<A> annotationType, String parameterName, jakarta.interceptor.InvocationContext context, Class<T> parameterType, T defaultValue)Gets overriding config parameter values if they're present from an invocation context.static <A extends Annotation>
StringgetPlainCanonicalName(Class<?> type)Helper method that gets the canonical name of an annotated class.static booleanisAnnotatedWithFaultToleranceAnnotations(jakarta.enterprise.inject.spi.Annotated element)static <T> Class<? extends T>[]toClassArray(String classNames, String attributeName, Class<? extends T>[] defaultValue)
-
-
-
Method Detail
-
getAnnotation
public static <A extends Annotation> A getAnnotation(Stereotypes sterotypes, Class<A> annotationClass, jakarta.interceptor.InvocationContext context)
Gets the annotation from the method that triggered the interceptor.- Type Parameters:
A- The annotation type to return- Parameters:
sterotypes- The invoking interceptor's context on sterotype annotationsannotationClass- The class of the annotation to getcontext- The context of the method invocation- Returns:
- The annotation that triggered the interceptor.
-
getOverrideValue
public static <A extends Annotation,T> T getOverrideValue(org.eclipse.microprofile.config.Config config, Class<A> annotationType, String parameterName, jakarta.interceptor.InvocationContext context, Class<T> parameterType, T defaultValue)
Gets overriding config parameter values if they're present from an invocation context.- Type Parameters:
A- The annotation type- Parameters:
config- The config to get the overriding parameter values fromannotationType- The annotation classparameterName- The name of the parameter to get the override value ofcontext- The context of the invoking requestparameterType- The type of the parameter to get the override value of- Returns:
-
getEnabledOverrideValue
public static <A extends Annotation> boolean getEnabledOverrideValue(org.eclipse.microprofile.config.Config config, Class<A> annotationType, jakarta.interceptor.InvocationContext context, boolean defaultValue)
Gets overriding config enabled parameter value if it's present from an invocation context. This follows a different priority logic than other parameter overrides.- Type Parameters:
A- The annotation type- Parameters:
config- The config to get the overriding enabled value fromannotationType- The annotation classcontext- The context of the invoking request- Returns:
-
getAnnotatedMethodClass
public static <A extends Annotation> Class<?> getAnnotatedMethodClass(jakarta.interceptor.InvocationContext context, Class<A> annotationClass)
Returns either the CDI Proxy class (for cases where a class extends another without overriding the target method), or the actual declaring class if the annotation isn't present on the proxy class.- Type Parameters:
A- The class of the annotation- Parameters:
context- The context of the method invocationannotationClass- The class of the annotation- Returns:
- The class of the annotated method
-
getPlainCanonicalName
public static <A extends Annotation> String getPlainCanonicalName(Class<?> type)
Helper method that gets the canonical name of an annotated class. This is used to strip out any Weld proxy naming that gets appended to the real class name.- Type Parameters:
A- The class of the annotation- Parameters:
type- The class of the annotation- Returns:
- The canonical name of the annotated method's class
-
getCanonicalMethodName
public static String getCanonicalMethodName(jakarta.interceptor.InvocationContext context)
Gets the full method signature from an invocation context, stripping out any Weld proxy name gubbins.- Parameters:
context- The context of the method invocation- Returns:
- full canonical name of the method as in
my.pack.MyClass.myMethod
-
isAnnotatedWithFaultToleranceAnnotations
public static boolean isAnnotatedWithFaultToleranceAnnotations(jakarta.enterprise.inject.spi.Annotated element)
-
-