Class OpenTracingCdiUtils


  • public class OpenTracingCdiUtils
    extends Object
    Utilities class for various CDI-based operations used by the OpenTracing Service classes.
    Author:
    Andrew Pielage , Arjan Tijms
    • Constructor Detail

      • OpenTracingCdiUtils

        public OpenTracingCdiUtils()
    • Method Detail

      • getAnnotation

        public static <A extends Annotation> A getAnnotation​(jakarta.enterprise.inject.spi.BeanManager beanManager,
                                                             Class<A> annotationClass,
                                                             jakarta.interceptor.InvocationContext invocationContext)
        Gets the annotation from the method that triggered the interceptor.
        Type Parameters:
        A - The annotation type to return
        Parameters:
        beanManager - The invoking interceptor's BeanManager
        annotationClass - The class of the annotation to get
        invocationContext - The context of the method invocation
        Returns:
        The annotation that triggered the interceptor.
      • getAnnotation

        public static <A extends Annotation> A getAnnotation​(jakarta.enterprise.inject.spi.BeanManager beanManager,
                                                             Class<A> annotationClass,
                                                             jakarta.ws.rs.container.ResourceInfo resourceInfo)
        Gets the annotation from the method that triggered the interceptor.
        Type Parameters:
        A - The annotation type to return
        Parameters:
        beanManager - The invoking interceptor's BeanManager
        annotationClass - The class of the annotation to get
        resourceInfo - The targeted jaxrs resource
        Returns:
        The annotation that triggered the interceptor.
      • getAnnotation

        public static <A extends Annotation> A getAnnotation​(jakarta.enterprise.inject.spi.BeanManager beanManager,
                                                             Class<A> annotationClass,
                                                             Class<?> annotatedClass,
                                                             Method method)
      • getConfigOverrideValue

        public static <A extends Annotation,​T> Optional<T> getConfigOverrideValue​(Class<A> annotationClass,
                                                                                        String parameterName,
                                                                                        jakarta.interceptor.InvocationContext invocationContext,
                                                                                        Class<T> parameterType)
        Gets overriding config parameter values if they're present from an invocation context.
        Type Parameters:
        A - The annotation type
        Parameters:
        annotationClass - The annotation class
        parameterName - The name of the parameter to get the override value of
        invocationContext - The context of the invoking request
        parameterType - The type of the parameter to get the override value of
        Returns:
        An Optional containing the override value from the config if there is one
      • getConfigOverrideValue

        public static <A extends Annotation,​T> Optional<T> getConfigOverrideValue​(Class<A> annotationClass,
                                                                                        String parameterName,
                                                                                        Method method,
                                                                                        Class<T> parameterType)
        Gets overriding config parameter values if they're present from an invocation context.
        Type Parameters:
        A - The annotation type
        Parameters:
        annotationClass - The annotation class
        parameterName - The name of the parameter to get the override value of
        method - The method to be invoked
        parameterType - The type of the parameter to get the override value of
        Returns:
        An Optional containing the override value from the config if there is one
      • getConfigOverrideValue

        public static <A extends Annotation,​T> Optional<T> getConfigOverrideValue​(Class<A> annotationClass,
                                                                                        String parameterName,
                                                                                        jakarta.ws.rs.container.ResourceInfo resourceInfo,
                                                                                        Class<T> parameterType)
        Gets overriding config parameter values if they're present from an invocation context.
        Type Parameters:
        A - The annotation type
        Parameters:
        annotationClass - The annotation class
        parameterName - The name of the parameter to get the override value of
        resourceInfo - The targeted jaxrs resource
        parameterType - The type of the parameter to get the override value of
        Returns:
        An Optional containing the override value from the config if there is one