Class HaCdiCommons


  • public class HaCdiCommons
    extends Object
    Helper class for common names definition for CDI plugins
    • Constructor Detail

      • HaCdiCommons

        public HaCdiCommons()
    • Method Detail

      • isJakarta

        public static boolean isJakarta​(org.hotswap.agent.javassist.ClassPool classPool)
      • getBeanClass

        public static Class<?> getBeanClass​(Object bean)
      • isInExtraScope

        public static boolean isInExtraScope​(Object bean)
      • transformContext

        public static void transformContext​(org.hotswap.agent.javassist.ClassPool classPool,
                                            org.hotswap.agent.javassist.CtClass ctClass)
                                     throws org.hotswap.agent.javassist.CannotCompileException,
                                            org.hotswap.agent.javassist.NotFoundException
        Add bean registry field to context, register bean instances in get(...) methods
        Parameters:
        classPool - the class pool
        ctClass - the ct class
        Throws:
        org.hotswap.agent.javassist.CannotCompileException - cannot compile exception
        org.hotswap.agent.javassist.NotFoundException - the not found exception
      • addBeanRegistryToContext

        public static void addBeanRegistryToContext​(org.hotswap.agent.javassist.ClassPool classPool,
                                                    org.hotswap.agent.javassist.CtClass ctClass)
                                             throws org.hotswap.agent.javassist.CannotCompileException
        Adds the bean registry to context.
        Parameters:
        classPool - the class pool
        ctClass - the ct class
        Throws:
        org.hotswap.agent.javassist.CannotCompileException - cannot compile exception
      • getBeanInstances

        public static List<Object> getBeanInstances​(Object bean)
        Return all bean instances.
        Parameters:
        bean - the bean
        Returns:
        the bean instances
      • registerContextClass

        public static void registerContextClass​(Class<? extends Annotation> scope,
                                                Class<?> contextClass)
        Register context class.
        Parameters:
        scope - the scope
        contextClass - the context class
      • getContextClass

        public static Class<?> getContextClass​(Class<? extends Annotation> scope)
        Gets the context class for specified scope.
        Parameters:
        scope - the scope
        Returns:
        the context class
      • isRegisteredScope

        public static boolean isRegisteredScope​(Class<? extends Annotation> scope)
        Checks if scope is registered
        Parameters:
        scope - the scope
        Returns:
        true, if is registered scope
      • registerExtraContext

        public static void registerExtraContext​(HaCdiExtraContext extraContext)
        Register extra context.
        Parameters:
        extraContext - the extra context
      • unregisterExtraContext

        public static void unregisterExtraContext​(HaCdiExtraContext extraContext)
        Unregister extra context.
        Parameters:
        extraContext - the extra context