Package org.hotswap.agent.plugin.cdi
Class HaCdiCommons
- java.lang.Object
-
- org.hotswap.agent.plugin.cdi.HaCdiCommons
-
public class HaCdiCommons extends Object
Helper class for common names definition for CDI plugins
-
-
Constructor Summary
Constructors Constructor Description HaCdiCommons()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddBeanRegistryToContext(org.hotswap.agent.javassist.ClassPool classPool, org.hotswap.agent.javassist.CtClass ctClass)Adds the bean registry to context.static Class<?>getBeanClass(Object bean)static List<Object>getBeanInstances(Object bean)Return all bean instances.static Class<? extends Annotation>getBeanScope(Object bean)static Class<?>getContextClass(Class<? extends Annotation> scope)Gets the context class for specified scope.static booleanisInExtraScope(Object bean)static booleanisJakarta(org.hotswap.agent.javassist.ClassPool classPool)static booleanisRegisteredScope(Class<? extends Annotation> scope)Checks if scope is registeredstatic voidregisterContextClass(Class<? extends Annotation> scope, Class<?> contextClass)Register context class.static voidregisterExtraContext(HaCdiExtraContext extraContext)Register extra context.static voidtransformContext(org.hotswap.agent.javassist.ClassPool classPool, org.hotswap.agent.javassist.CtClass ctClass)Add bean registry field to context, register bean instances in get(...) methodsstatic voidunregisterExtraContext(HaCdiExtraContext extraContext)Unregister extra context.
-
-
-
Method Detail
-
isJakarta
public static boolean isJakarta(org.hotswap.agent.javassist.ClassPool classPool)
-
getBeanScope
public static Class<? extends Annotation> getBeanScope(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.NotFoundExceptionAdd bean registry field to context, register bean instances in get(...) methods- Parameters:
classPool- the class poolctClass- the ct class- Throws:
org.hotswap.agent.javassist.CannotCompileException- cannot compile exceptionorg.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.CannotCompileExceptionAdds the bean registry to context.- Parameters:
classPool- the class poolctClass- 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 scopecontextClass- 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
-
-