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

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

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

Interceptor.create介绍

暂无

代码示例

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

public <T> Map<Interceptor<?>, Object> createInterceptorInstances(BeanInterceptorInfo interceptorInfo,
                                 CreationalContextImpl<T> creationalContextImpl)
{
  Map<Interceptor<?>,Object> interceptorInstances  = new HashMap<>();
  if (interceptorInfo != null)
  {
    // apply interceptorInfo
    // create EJB-style interceptors
    for (Interceptor interceptorBean : interceptorInfo.getEjbInterceptors())
    {
      creationalContextImpl.putContextual(interceptorBean);
      interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
    }
    // create CDI-style interceptors
    for (Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
    {
      creationalContextImpl.putContextual(interceptorBean);
      interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
    }
    for (Interceptor interceptorBean : interceptorInfo.getConstructorCdiInterceptors())
    {
      creationalContextImpl.putContextual(interceptorBean);
      interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
    }
  }
  return interceptorInstances;
}

代码示例来源:origin: org.apache.tomee/openejb-core

public T createNewPojo(final CreationalContext<T> creationalContext) {
  final CreationalContextImpl<T> ccImpl = CreationalContextImpl.class.cast(creationalContext);
  // super.produce(cc) will not work since we need the unproxied instance - decorator case
  final Map<javax.enterprise.inject.spi.Interceptor<?>, Object> interceptorInstances = super.createInterceptorInstances(ccImpl);
  final InterceptorResolutionService.BeanInterceptorInfo interceptorInfo = super.getInterceptorInfo();
  if (interceptorInfo != null) {
    final Map<Constructor<?>, InterceptorResolutionService.BusinessMethodInterceptorInfo> constructorInterceptorInfos =
        interceptorInfo.getConstructorInterceptorInfos();
    if (!constructorInterceptorInfos.isEmpty()) { // were missed by OWB
      final javax.enterprise.inject.spi.Interceptor<?>[] ejbInterceptors = constructorInterceptorInfos.values().iterator().next().getEjbInterceptors();
      if (null != ejbInterceptors) {
        for (final javax.enterprise.inject.spi.Interceptor interceptorBean : ejbInterceptors) {
          if (!interceptorInstances.containsKey(interceptorBean)) {
            ccImpl.putContextual(interceptorBean);
            interceptorInstances.put(interceptorBean, interceptorBean.create(ccImpl));
          }
        }
      }
    }
  }
  final T produce = super.produce(interceptorInstances, ccImpl);
  if (produce == null) { // user didnt call ic.proceed() in @AroundConstruct
    return super.newInstance(ccImpl);
  }
  return (T) produce;
}

代码示例来源:origin: apache/deltaspike

interceptorInstance = interceptor.create(creationalContext);

相关文章