Beispiel #1
0
 private void validateEnabledInterceptorClasses(BeanManagerImpl beanManager) {
   Set<Class<?>> interceptorBeanClasses = new HashSet<Class<?>>();
   for (Interceptor<?> interceptor : beanManager.getAccessibleInterceptors()) {
     interceptorBeanClasses.add(interceptor.getBeanClass());
   }
   for (Metadata<Class<?>> enabledInterceptorClass : beanManager.getEnabled().getInterceptors()) {
     if (!interceptorBeanClasses.contains(enabledInterceptorClass.getValue())) {
       throw new DeploymentException(
           INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED, enabledInterceptorClass);
     }
   }
 }
 private void validateInterceptor(Interceptor<?> interceptor) {
   Set<Annotation> bindings = interceptor.getInterceptorBindings();
   if (bindings == null) {
     throw InterceptorLogger.LOG.nullInterceptorBindings(interceptor);
   }
   for (Annotation annotation : bindings) {
     if (!getBeanManager().isInterceptorBinding(annotation.annotationType())) {
       throw MetadataLogger.LOG.notAnInterceptorBinding(annotation, interceptor);
     }
   }
 }
Beispiel #3
0
  private InterceptorMetadata<SerializableContextual<?, ?>>[] toSerializableContextualArray(
      List<Interceptor<?>> interceptors) {
    List<InterceptorMetadata<SerializableContextual<Interceptor<?>, ?>>> serializableContextuals =
        new ArrayList<InterceptorMetadata<SerializableContextual<Interceptor<?>, ?>>>();
    for (Interceptor<?> interceptor : interceptors) {

      SerializableContextualImpl<Interceptor<?>, ?> contextual =
          new SerializableContextualImpl(interceptor, getServices().get(ContextualStore.class));
      serializableContextuals.add(
          beanManager
              .getInterceptorMetadataReader()
              .getInterceptorMetadata(
                  new SerializableContextualInterceptorReference(
                      contextual,
                      beanManager
                          .getInterceptorMetadataReader()
                          .getClassMetadata(interceptor.getBeanClass()))));
    }
    return serializableContextuals.toArray(
        AbstractClassBean.<SerializableContextual<?, ?>>emptyInterceptorMetadataArray());
  }