Codota Logo
BeanManager.getExtension
Code IndexAdd Codota to your IDE (free)

How to use
getExtension
method
in
javax.enterprise.inject.spi.BeanManager

Best Java code snippets using javax.enterprise.inject.spi.BeanManager.getExtension (Showing top 20 results out of 315)

  • Common ways to obtain BeanManager
private void myMethod () {
BeanManager b =
  • Codota IconCDI.current().getBeanManager()
  • Codota IconBeanManagerProvider.getInstance().getBeanManager()
  • Codota IconWeldContainer container;container.getBeanManager()
  • Smart code suggestions by Codota
}
origin: oracle/helidon

private void resourcesFromContainer() {
  ServerCdiExtension extension = cdiContainer.getBeanManager().getExtension(ServerCdiExtension.class);
  if (null == extension) {
    throw new RuntimeException("Failed to find JAX-RS resource to use, extension not registered with container");
  }
  List<Class<? extends Application>> applications = extension.getApplications();
  if (applications.isEmpty()) {
    List<Class<?>> resourceClasses = extension.getResourceClasses();
    if (resourceClasses.isEmpty()) {
      LOGGER.warning("Failed to find JAX-RS resource to use");
    }
    resourceConfig = configForResourceClasses(resourceClasses);
  } else {
    applications.forEach(this::addApplication);
  }
}
origin: jersey/jersey

  /**
   * Provide a value for given injection point. If the injection point does not refer
   * to a CDI bean constructor parameter, or the value could not be found, the method will return null.
   *
   * @param injectionPoint actual injection point.
   * @param beanManager    current application bean manager.
   * @return concrete JAX-RS parameter value for given injection point.
   */
  @javax.enterprise.inject.Produces
  @JaxRsParamQualifier
  public String getParameterValue(final InjectionPoint injectionPoint, final BeanManager beanManager) {
    final Parameter parameter = parameterCache.apply(injectionPoint);
    if (parameter != null) {
      InjectionManager injectionManager =
          beanManager.getExtension(CdiComponentProvider.class).getEffectiveInjectionManager();
      Set<ValueParamProvider> providers = Providers.getProviders(injectionManager, ValueParamProvider.class);
      ContainerRequest containerRequest = injectionManager.getInstance(ContainerRequest.class);
      for (ValueParamProvider vfp : providers) {
        Function<ContainerRequest, ?> paramValueSupplier = vfp.getValueProvider(parameter);
        if (paramValueSupplier != null) {
          return (String) paramValueSupplier.apply(containerRequest);
        }
      }
    }
    return null;
  }
}
origin: jersey/jersey

@Override
public void initialize(final InjectionManager injectionManager) {
  this.injectionManager = injectionManager;
  this.beanManager = CdiUtil.getBeanManager();
  if (beanManager != null) {
    // Try to get CdiComponentProvider created by CDI.
    final CdiComponentProvider extension = beanManager.getExtension(CdiComponentProvider.class);
    if (extension != null) {
      extension.addInjectionManager(this.injectionManager);
      this.fieldsToSkip = extension.getFieldsToSkip();
      this.methodsToSkip = extension.getMethodsToSkip();
      bindHk2ClassAnalyzer();
      LOGGER.config(LocalizationMessages.CDI_PROVIDER_INITIALIZED());
    }
  }
}
origin: io.smallrye/smallrye-fault-tolerance

@Inject
public DefaultFaultToleranceOperationProvider(BeanManager beanManager) {
  this.extension = beanManager.getExtension(HystrixExtension.class);
}
origin: org.jboss.weld.se/weld-se

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: org.jboss.weld.se/weld-se-shaded

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: weld/core

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: org.jboss.cdi.tck/cdi-tck-impl

  private DummyConfiguringExtension getDummyConfiguringExtension() {
    return getCurrentManager().getExtension(DummyConfiguringExtension.class);
  }
}
origin: org.jboss.weld.servlet/weld-servlet-shaded

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: weld/core

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: weld/core

@Override
public <T extends Extension> T getExtension(Class<T> extensionClass) {
  return delegate().getExtension(extensionClass);
}
origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = AFTER_BEAN_DISCOVERY, id = "ea")
public void testProcessObserverMethodFiredWhileAddingObserverMethod() {
  assertEquals(getCurrentManager().getExtension(AfterBeanDiscoveryObserver.class).getTalkPOMObservedCount().get(), 1);
  assertEquals(getCurrentManager().getExtension(AfterBeanDiscoveryObserver.class).getTalkPSOMObservedCount().get(), 1);
}
origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertions({ @SpecAssertion(section = AFTER_BEAN_DISCOVERY, id = "da"), @SpecAssertion(section = PROCESS_BEAN, id = "eca") })
public void testProcessBeanIsFired() {
  assertEquals(getCurrentManager().getExtension(AfterBeanDiscoveryObserver.class).getCockatooPBObservedCount().get(), 1);
  assertEquals(getCurrentManager().getExtension(AfterBeanDiscoveryObserver.class).getCockatooPSBObservedCount().get(), 1);
}
origin: io.astefanutti.metrics.cdi/metrics-cdi

  @Produces
  // TODO: should be declared @ApplicationScoped when WELD-2083 is fixed
  private MetricName metricName(BeanManager manager) {
    try {
      // Cannot be inlined as OWB throws a NPE when manager.getELResolver() gets called
      ExpressionFactory factory = ExpressionFactory.newInstance();
      return new ElMetricName(manager.getELResolver(), manager.wrapExpressionFactory(factory), manager.getExtension(MetricsExtension.class));
    } catch (ELException cause) {
      // Falls back to SE
      return new SeMetricName(manager.getExtension(MetricsExtension.class));
    }
  }
}
origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = PROCESS_ANNOTATED_TYPE, id = "bba")
public void configuratorInitializedWithOriginalAT() {
  AnnotatedType<Cat> catAT = getCurrentManager().getExtension(ProcessAnnotatedTypeObserver.class).getOriginalCatAT();
  assertTrue(catAT.isAnnotationPresent(RequestScoped.class));
  AnnotatedConstructor<Cat> annotatedConstructor = catAT.getConstructors().stream()
      .filter(ac -> ac.getParameters().size() == 1 && ac.getParameters().get(0).getBaseType().equals(Feed.class)).findFirst().get();
  assertTrue(annotatedConstructor.getParameters().iterator().next().isAnnotationPresent(Cats.class));
  assertTrue(annotatedConstructor.isAnnotationPresent(Inject.class));
}
origin: org.jboss.weld.vertx/weld-vertx-web

/**
 * Registers all the route handlers discovered.
 *
 * @param router
 * @throws IllegalStateException If the container is not initialized or already shut down
 */
public void registerRoutes(Router router) {
  container().getBeanManager().getExtension(RouteExtension.class).registerRoutes(router);
}
origin: weld/weld-vertx

/**
 * Registers all the route handlers discovered.
 *
 * @param router
 * @throws IllegalStateException If the container is not initialized or already shut down
 */
public void registerRoutes(Router router) {
  container().getBeanManager().getExtension(RouteExtension.class).registerRoutes(router);
}
origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = PROCESS_OBSERVER_METHOD, id = "dab")
public void configuratorInitializedWithOriginalObserverMethod() {
  ObserverMethod<? super Kiwi> configuredOne = getCurrentManager().resolveObserverMethods(new Kiwi(), Ripe.RipeLiteral.INSTANCE).iterator().next();
  ObserverMethod<Kiwi> originalOne = getCurrentManager().getExtension(ProcessObserverMethodObserver.class).getOriginalOM();
  assertEquals(configuredOne.getObservedType(), originalOne.getObservedType());
  assertEquals(configuredOne.getObservedQualifiers(), originalOne.getObservedQualifiers());
  assertEquals(configuredOne.getPriority(), originalOne.getPriority());
}
origin: org.jboss.cdi.tck/cdi-tck-impl

  @Test
  @SpecAssertions({ @SpecAssertion(section = PROCESS_INJECTION_POINT, id = "bba") })
  public void configuratorInitializedWithOriginalInjectionPoint() {
    InjectionPoint configuredOne = getUniqueBean(Helicopter.class).getInjectionPoints().iterator().next();
    InjectionPoint originalOne = getCurrentManager().getExtension(ProcessInjectionPointObserver.class).getEngineIP();
    assertEquals(configuredOne.getType(), originalOne.getType());
    assertEquals(configuredOne.getQualifiers(), originalOne.getQualifiers());
    assertEquals(configuredOne.getAnnotated(), originalOne.getAnnotated());
    assertEquals(configuredOne.getBean(), originalOne.getBean());
  }
}
origin: org.jboss.cdi.tck/cdi-tck-impl

  @Test
  @SpecAssertion(section = PROCESS_BEAN_ATTRIBUTES, id = "bca")
  public void configuratorInitializedWithOriginalBeanAttributes() {
    Bean<Mace> configuredBean = getUniqueBean(Mace.class);
    BeanAttributes<Mace> originalBA = getCurrentManager().getExtension(ProcessBeanAttributesObserver.class).getOriginalBA();
    assertEquals(configuredBean.getTypes(), originalBA.getTypes());
    assertEquals(configuredBean.getQualifiers(), originalBA.getQualifiers());
    assertEquals(configuredBean.getStereotypes(), originalBA.getStereotypes());
    assertEquals(configuredBean.getScope(), originalBA.getScope());
  }
}
javax.enterprise.inject.spiBeanManagergetExtension

Javadoc

Obtains the container's instance of an Extension class declared in META-INF/services.

Popular methods of BeanManager

  • createCreationalContext
    Obtain an instance of a javax.enterprise.context.spi.CreationalContext for the given javax.enterpris
  • getBeans
    Return the set of beans which have the given required type and qualifiers and are available for inje
  • getReference
    Obtains a contextual reference for a certain Bean and a certain bean type of the bean.
  • resolve
    Apply the ambiguous dependency resolution rules to a set of Bean. Note that when called during invoc
  • createAnnotatedType
    Obtain an AnnotatedType that may be used to read the annotations of the given class or interface.
  • createInjectionTarget
    Obtains an InjectionTarget for the given AnnotatedType. The container ignores the annotations and t
  • fireEvent
    Fire an event and notify observers. This method is deprecated from CDI 2.0 and #getEvent()) should b
  • getContext
    Obtains an active javax.enterprise.context.spi.Context for the given javax.enterprise.context .
  • isNormalScope
    Test the given annotation type to determine if it is a javax.enterprise.context.
  • isQualifier
    Test the given annotation type to determine if it is a javax.inject.Qualifier.
  • isStereotype
    Test the given annotation type to determine if it is a javax.enterprise.inject.Stereotype.
  • getInjectableReference
    Obtains an injectable reference for a certain InjectionPoint.
  • isStereotype,
  • getInjectableReference,
  • getELResolver,
  • isScope,
  • getPassivationCapableBean,
  • getInjectionTargetFactory,
  • getStereotypeDefinition,
  • wrapExpressionFactory,
  • isInterceptorBinding

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now