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

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

Best Java code snippets using javax.enterprise.inject.spi.BeanManager.isNormalScope (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: picketlink/picketlink

private boolean isNormalScope(final Set<Annotation> annotations, final BeanManager bm)
{
  for (Annotation annotation : annotations)
  {
    if (bm.isNormalScope(annotation.annotationType()))
    {
      return true;
    }
  }
  return false;
}
origin: apache/deltaspike

private boolean isNormalScope(final Set<Annotation> annotations, final BeanManager bm)
{
  for (Annotation annotation : annotations)
  {
    if (bm.isNormalScope(annotation.annotationType()))
    {
      return true;
    }
  }
  return false;
}
origin: weld/core

@Override
public boolean isNormalScope(Class<? extends Annotation> annotationType) {
  return delegate().isNormalScope(annotationType);
}
origin: org.apache.tomee/openejb-core

private void starts(final BeanManager beanManager, final Class<?> clazz) {
  final Bean<?> bean = beanManager.resolve(beanManager.getBeans(clazz));
  if (!beanManager.isNormalScope(bean.getScope())) {
    throw new IllegalStateException("Only normal scoped beans can use @Startup - likely @ApplicationScoped");
  }
  final CreationalContext<Object> creationalContext = beanManager.createCreationalContext(null);
  beanManager.getReference(bean, clazz, creationalContext).toString();
  // don't release now, will be done by the context - why we restrict it to normal scoped beans
}
origin: org.jboss.weld.servlet/weld-servlet-shaded

@Override
public boolean isNormalScope(Class<? extends Annotation> annotationType) {
  return delegate().isNormalScope(annotationType);
}
origin: apache/deltaspike

  private <T> T lookupByName(final String name, final Class<T> type)
  {
    final Set<Bean<?>> tfb = beanManager.getBeans(name);
    final Bean<?> bean = beanManager.resolve(tfb);
    final CreationalContext<?> ctx = beanManager.createCreationalContext(null);
    if (!beanManager.isNormalScope(bean.getScope()))
    {
      contexts.add(ctx);
    }
    return type.cast(beanManager.getReference(bean, type, ctx));
  }
}
origin: org.apache.geronimo/geronimo-metrics

private Object getInstance(final Class<?> javaClass, final BeanManager beanManager, final Bean<?> bean) {
  final CreationalContext<Object> creationalContext = beanManager.createCreationalContext(null);
  final Object reference = beanManager.getReference(bean, javaClass, creationalContext);
  if (!beanManager.isNormalScope(bean.getScope())) {
    creationalContexts.add(creationalContext);
  }
  return reference;
}
origin: org.apache.deltaspike.modules/deltaspike-jsf-module-impl

protected <X> boolean hasNormalScopeAnnotation(Bean<X> bean, BeanManager beanManager)
{
  Class<? extends Annotation> scopeAnnotationClass = bean.getScope();
  return scopeAnnotationClass != null && beanManager.isNormalScope(scopeAnnotationClass);
}
origin: com.blazebit/blaze-persistence-integration-deltaspike-data-impl-1.7

private synchronized void init(BeanManager beanManager) {
  if (queryInOutMapperIsNormalScope != null) {
    return;
  }
  if (beanManager != null) {
    final Set<Bean<?>> beans = beanManager.getBeans(mapper);
    final Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    queryInOutMapperIsNormalScope = beanManager.isNormalScope(scope);
  } else {
    queryInOutMapperIsNormalScope = false;
  }
}
origin: org.jboss.weld.se/weld-se

@Override
public boolean isNormalScope(Class<? extends Annotation> annotationType) {
  return delegate().isNormalScope(annotationType);
}
origin: Blazebit/blaze-persistence

private synchronized void init(BeanManager beanManager) {
  if (queryInOutMapperIsNormalScope != null) {
    return;
  }
  if (beanManager != null) {
    final Set<Bean<?>> beans = beanManager.getBeans(mapper);
    final Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    queryInOutMapperIsNormalScope = beanManager.isNormalScope(scope);
  } else {
    queryInOutMapperIsNormalScope = false;
  }
}
origin: com.tomitribe.tribestream/tribestream-container

public <T> T getBean(final Class<T> type) { // ATM we recommand getting it once but if needed we can cache it in a concurrent map
  final BeanManager manager = getBeanManager();
  final Bean<?> bean = manager.resolve(manager.getBeans(type));
  if (!manager.isNormalScope(bean.getScope()) && !type.isAnnotationPresent(Singleton.class)) {
    throw new IllegalArgumentException("Only normal scoped instances or singleton EJB can use getBean()");
  }
  return type.cast(manager.getReference(bean, type, null));
}
origin: Blazebit/blaze-persistence

private synchronized void init(BeanManager beanManager, EntityViewManager evm) {
  if (entityManagerResolverIsNormalScope != null) {
    return;
  }
  initialize(evm);
  if (entityManagerResolver != null && beanManager != null) {
    final Set<Bean<?>> beans = beanManager.getBeans(entityManagerResolver);
    final Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    entityManagerResolverIsNormalScope = beanManager.isNormalScope(scope);
  } else {
    entityManagerResolverIsNormalScope = false;
  }
}
origin: org.apache.geronimo/geronimo-health

  private HealthCheck lookup(final Bean<?> bean, final BeanManager manager) {
    final Class<?> type = bean.getBeanClass() == null ? HealthCheck.class : bean.getBeanClass();
    final Set<Bean<?>> beans = manager.getBeans(type, bean.getQualifiers().toArray(new Annotation[bean.getQualifiers().size()]));
    final Bean<?> resolvedBean = manager.resolve(beans);
    final CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
    if (!manager.isNormalScope(resolvedBean.getScope())) {
      contexts.add(creationalContext);
    }
    return HealthCheck.class.cast(manager.getReference(resolvedBean, HealthCheck.class, creationalContext));
  }
}
origin: org.jboss.cdi.tck/cdi-tck-impl

@Test
@SpecAssertion(section = BM_DETERMINING_ANNOTATION, id = "ag")
public void testDetermineScopeType() {
  assertTrue(getCurrentManager().isNormalScope(RequestScoped.class));
  assertFalse(getCurrentManager().isPassivatingScope(RequestScoped.class));
  assertTrue(getCurrentManager().isNormalScope(SessionScoped.class));
  assertTrue(getCurrentManager().isPassivatingScope(SessionScoped.class));
  assertTrue(getCurrentManager().isNormalScope(DummyScoped.class));
  assertFalse(getCurrentManager().isPassivatingScope(DummyScoped.class));
}
origin: com.blazebit/blaze-persistence-integration-deltaspike-data-impl-1.8

private void initQueryInOutMapperIsNormalScope(RepositoryMetadata repositoryMetadata, RepositoryMethodMetadata repositoryMethodMetadata, BeanManager beanManager) {
  if (repositoryMethodMetadata.getQueryInOutMapperClass() != null) {
    Set<Bean<?>> beans = beanManager.getBeans(repositoryMethodMetadata.getQueryInOutMapperClass());
    Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    repositoryMethodMetadata.setQueryInOutMapperIsNormalScope(beanManager.isNormalScope(scope));
  }
}
origin: org.apache.deltaspike.modules/deltaspike-data-module-impl

private void initQueryInOutMapperIsNormalScope(RepositoryMethodMetadata repositoryMethodMetadata,
                        BeanManager beanManager)
{
  if (repositoryMethodMetadata.getQueryInOutMapperClass() != null)
  {
    Set<Bean<?>> beans = beanManager.getBeans(repositoryMethodMetadata.getQueryInOutMapperClass());
    Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    repositoryMethodMetadata.setQueryInOutMapperIsNormalScope(beanManager.isNormalScope(scope));
  }
}
origin: Blazebit/blaze-persistence

private void initQueryInOutMapperIsNormalScope(RepositoryMetadata repositoryMetadata, RepositoryMethodMetadata repositoryMethodMetadata, BeanManager beanManager) {
  if (repositoryMethodMetadata.getQueryInOutMapperClass() != null) {
    Set<Bean<?>> beans = beanManager.getBeans(repositoryMethodMetadata.getQueryInOutMapperClass());
    Class<? extends Annotation> scope = beanManager.resolve(beans).getScope();
    repositoryMethodMetadata.setQueryInOutMapperIsNormalScope(beanManager.isNormalScope(scope));
  }
}
origin: apache/deltaspike

/**
 * This method will properly destroy the &#064;Dependent scoped instance.
 * It will have no effect if the bean is NormalScoped as those have their
 * own lifecycle which we must not disrupt.
 */
public void destroy()
{
  if (!BeanManagerProvider.getInstance().getBeanManager().isNormalScope(bean.getScope()))
  {
    bean.destroy(instance, creationalContext);
  }
}
origin: org.apache.deltaspike.core/deltaspike-core-api

/**
 * This method will properly destroy the &#064;Dependent scoped instance.
 * It will have no effect if the bean is NormalScoped as those have their
 * own lifecycle which we must not disrupt.
 */
public void destroy()
{
  if (!BeanManagerProvider.getInstance().getBeanManager().isNormalScope(bean.getScope()))
  {
    bean.destroy(instance, creationalContext);
  }
}
javax.enterprise.inject.spiBeanManagerisNormalScope

Javadoc

Test the given annotation type to determine if it is a javax.enterprise.context.

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 .
  • 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.
  • getELResolver
    Returns a javax.el.ELResolver that resolves beans by EL name.
  • getInjectableReference,
  • getELResolver,
  • isScope,
  • getPassivationCapableBean,
  • getInjectionTargetFactory,
  • getStereotypeDefinition,
  • wrapExpressionFactory,
  • getExtension,
  • isInterceptorBinding

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Kernel (java.awt.image)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • IsNull (org.hamcrest.core)
    Is the value null?
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
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