javax.enterprise.inject.spi.Interceptor.getScope()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中javax.enterprise.inject.spi.Interceptor.getScope()方法的一些代码示例,展示了Interceptor.getScope()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interceptor.getScope()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.Interceptor
类名称:Interceptor
方法名:getScope

Interceptor.getScope介绍

暂无

代码示例

代码示例来源:origin: org.jboss.weld.integration/weld-jboss-int-jboss-ejb

@SuppressWarnings("unchecked")
private void addInterceptorInstance(Interceptor<Object> interceptor, InvocationContext invocationContext)
{
 CreationalContext<Object> creationalContext = (CreationalContext<Object>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
 Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext);
 SerializableContextualInstance<Interceptor<Object>,Object> serializableContextualInstance
    = beanManager.getServices().get(ContextualStore.class).getSerializableContextualInstance(interceptor, instance, creationalContext);
 interceptorInstances.put(interceptor.getBeanClass().getName(), serializableContextualInstance);
}

代码示例来源:origin: org.jboss.jbossas/weld-int-ejb

@SuppressWarnings("unchecked")
private void addInterceptorInstance(Interceptor<Object> interceptor, InvocationContext invocationContext)
{
 CreationalContext<Object> creationalContext = (CreationalContext<Object>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
 Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext);
 SerializableContextualInstance<Interceptor<Object>,Object> serializableContextualInstance
    = beanManager.getServices().get(ContextualStore.class).<Interceptor<Object>,Object>getSerializableContextualInstance(interceptor, instance, creationalContext);
 interceptorInstances.put(interceptor.getBeanClass().getName(), serializableContextualInstance);
}

代码示例来源:origin: org.jboss.as/jboss-as-weld

@SuppressWarnings("unchecked")
private void addInterceptorInstance(Interceptor<Object> interceptor, BeanManagerImpl beanManager, Map<String, SerializableContextualInstance<Interceptor<Object>, Object>> instances) {
  Object instance = beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext);
  SerializableContextualInstance<Interceptor<Object>, Object> serializableContextualInstance
      = beanManager.getServices().get(ContextualStore.class).<Interceptor<Object>, Object>getSerializableContextualInstance(interceptor, instance, creationalContext);
  instances.put(interceptor.getBeanClass().getName(), serializableContextualInstance);
}

代码示例来源:origin: weld/core

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty() || !BeanMethods.getAsyncObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: weld/core

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty() || !BeanMethods.getAsyncObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty() || !BeanMethods.getAsyncObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: weld/core

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty() || !BeanMethods.getAsyncObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

protected void validateInterceptor(Interceptor<?> interceptor, BeanManagerImpl manager) {
  if (interceptor instanceof InterceptorImpl<?>) {
    EnhancedAnnotatedType<?> annotated = ((InterceptorImpl<?>) interceptor).getEnhancedAnnotated();
    if (!BeanMethods.getObserverMethods(annotated).isEmpty() || !BeanMethods.getAsyncObserverMethods(annotated).isEmpty()) {
      throw ValidatorLogger.LOG.interceptorsCannotHaveObserverMethods(interceptor);
    }
    if (!interceptor.getScope().equals(Dependent.class)) {
      throw ValidatorLogger.LOG.interceptorOrDecoratorMustBeDependent(interceptor);
    }
    while (annotated != null && annotated.getJavaClass() != Object.class) {
      if (!annotated.getDeclaredEnhancedMethods(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerMethods(interceptor);
      }
      if (!annotated.getDeclaredEnhancedFields(Produces.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveProducerFields(interceptor);
      }
      if (!annotated.getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class).isEmpty()) {
        throw ValidatorLogger.LOG.interceptorsCannotHaveDisposerMethods(interceptor);
      }
      annotated = annotated.getEnhancedSuperclass();
    }
  }
  for (InjectionPoint injectionPoint : interceptor.getInjectionPoints()) {
    validateInjectionPoint(injectionPoint, manager);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

if(interceptor.getScope() != Dependent.class)

相关文章