congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HaCdiCommons
Code IndexAdd Tabnine to your IDE (free)

How to use
HaCdiCommons
in
org.hotswap.agent.plugin.cdi

Best Java code snippets using org.hotswap.agent.plugin.cdi.HaCdiCommons (Showing top 13 results out of 315)

origin: HotswapProjects/HotswapAgent

  /**
   * Add custom tracker field to session context
   *
   * @param ctClass the class
   * @throws NotFoundException the not found exception
   * @throws CannotCompileException the cannot compile exception
   */
  @OnClassLoadEvent(classNameRegexp = "org.jboss.weld.context.AbstractContext")
  public static void transformHttpSessionContext(ClassPool classPool, CtClass ctClass) throws NotFoundException, CannotCompileException {
    HaCdiCommons.transformContext(classPool, ctClass);
  }
}
origin: HotswapProjects/HotswapAgent

@SuppressWarnings("rawtypes")
private static void doReinjectRegisteredBeanInstances(BeanManagerImpl beanManager, AbstractClassBean bean) {
  for (Object instance: HaCdiCommons.getBeanInstances(bean)) {
    if (instance != null) {
      doCallInject(beanManager, bean, instance);
    }
  }
}
origin: HotswapProjects/HotswapAgent

/**
 * Add bean registry field to context, register bean instances in get(...) methods
 *
 * @param classPool the class pool
 * @param ctClass the ct class
 * @throws CannotCompileException the cannot compile exception
 * @throws NotFoundException the not found exception
 */
public static void transformContext(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException {
  addBeanRegistryToContext(classPool, ctClass);
  transformGet1(classPool, ctClass);
  transformGet2(classPool, ctClass);
  LOGGER.debug(ctClass.getName() + " - patched by bean registration.");
}
origin: HotswapProjects/HotswapAgent

private static void doReinjectBean(BeanManagerImpl beanManager, AbstractClassBean<?> bean) {
  try {
    if (!bean.getScope().equals(ApplicationScoped.class) && HaCdiCommons.isRegisteredScope(bean.getScope())) {
      doReinjectRegisteredBeanInstances(beanManager, bean);
    } else {
      doReinjectBeanInstance(beanManager, bean, beanManager.getContext(bean.getScope()));
    }
  } catch (Exception e) {
    if (e.getClass().getSimpleName().equals("ContextNotActiveException")) {
      LOGGER.info("No active contexts for bean '{}'", bean.getBeanClass().getName());
    } else {
      throw e;
    }
  }
}
origin: HotswapProjects/HotswapAgent

/**
 * Return all bean instances.
 *
 * @param bean the bean
 * @return the bean instances
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List<Object> getBeanInstances(Bean<?> bean) {
  List<Object> result = new ArrayList<>();
  Class<? extends Context> contextClass = getContextClass(bean.getScope());
  Map beanRegistry = (Map) getBeanRegistry(contextClass);
  if (beanRegistry != null) {
    Map m = (Map) beanRegistry.get(bean.getBeanClass().getName());
    if (m != null) {
      result.addAll(m.keySet());
    } else {
      LOGGER.debug("BeanRegistry is empty for bean class '{}'", bean.getBeanClass().getName());
    }
  } else {
    LOGGER.error("BeanRegistry field not found in context class '{}'", contextClass.getName());
  }
  return result;
}
origin: HotswapProjects/HotswapAgent

/**
 * Checks if scope is registered
 *
 * @param scope the scope
 * @return true, if is registered scope
 */
public static boolean isRegisteredScope(Class<? extends Annotation> scope) {
  return getContextClass(scope) != null;
}
origin: HotswapProjects/HotswapAgent

private static void doReinjectBean(BeanManagerImpl beanManager, InjectionTargetBean<?> bean) {
  try {
    if (!bean.getScope().equals(ApplicationScoped.class) && HaCdiCommons.isRegisteredScope(bean.getScope())) {
      doReinjectRegisteredBeanInstances(beanManager, bean);
    } else {
      doReinjectBeanInstance(beanManager, bean, beanManager.getContext(bean.getScope()));
    }
  } catch (ContextNotActiveException e) {
    LOGGER.info("No active contexts for bean '{}'", bean.getBeanClass().getName());
  }
}
origin: HotswapProjects/HotswapAgent

  @OnClassLoadEvent(classNameRegexp = "org.apache.deltaspike.core.util.context.AbstractContext")
  public static void patchWindowContext(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException {
    HaCdiCommons.transformContext(classPool, ctClass);
  }
}
origin: HotswapProjects/HotswapAgent

@SuppressWarnings({ "unchecked", "rawtypes" })
private static void doReinjectRegisteredBeanInstances(BeanManagerImpl beanManager, InjectionTargetBean bean) {
  for (Object instance: HaCdiCommons.getBeanInstances(bean)) {
    if (instance != null) {
      bean.getProducer().inject(instance, beanManager.createCreationalContext(bean));
      LOGGER.info("Bean '{}' injection points was reinjected.", bean.getBeanClass().getName());
    } else {
      LOGGER.info("Unexpected 'null' bean instance in registry. bean='{}'", bean.getBeanClass().getName());
    }
  }
}
origin: HotswapProjects/HotswapAgent

@OnClassLoadEvent(classNameRegexp = "org.apache.myfaces.cdi.view.ViewScopeContextImpl")
public static void patchViewScopeContext(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException {
  HaCdiCommons.transformContext(classPool, ctClass);
}
origin: HotswapProjects/HotswapAgent

@OnClassLoadEvent(classNameRegexp = "org.omnifaces.cdi.viewscope.ViewScopeContext")
public static void patchViewScopeContext(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException {
  HaCdiCommons.transformContext(classPool, ctClass);
}
origin: HotswapProjects/HotswapAgent

@OnClassLoadEvent(classNameRegexp = "org.apache.webbeans.context.AbstractContext")
public static void transformAbstractContext(ClassPool classPool, CtClass ctClass) throws NotFoundException, CannotCompileException {
  HaCdiCommons.transformContext(classPool, ctClass);
}
origin: HotswapProjects/HotswapAgent

@OnClassLoadEvent(classNameRegexp = "com.sun.faces.application.view.ViewScopeContext")
public static void patchViewScopeContext(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException {
  HaCdiCommons.transformContext(classPool, ctClass);
}
org.hotswap.agent.plugin.cdiHaCdiCommons

Javadoc

Helper class for common names definition for CDI plugins

Most used methods

  • transformContext
    Add bean registry field to context, register bean instances in get(...) methods
  • getBeanInstances
    Return all bean instances.
  • isRegisteredScope
    Checks if scope is registered
  • addBeanRegistryToContext
    Adds the bean registry to context.
  • getBeanRegistry
  • getContextClass
    Gets the context class for specified scope.
  • getCurrentScopeToContextMap
  • getRegistrationCode
  • transformGet1
    Transform 1 argument get method :public T get(Contextual contextual);
  • transformGet2
    Transform 2 arguments get method :public T get(Contextual contextual, CreationalContext creationalCo

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Reference (javax.naming)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now