use of org.jboss.weld.interceptor.spi.model.InterceptionModel in project core by weld.
the class SubclassedComponentInstantiator method createEnhancedSubclass.
protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) {
Set<InterceptionModel> models = getInterceptionModelsForType(type, manager, bean);
Set<MethodSignature> enhancedMethodSignatures = new HashSet<MethodSignature>();
Set<MethodSignature> interceptedMethodSignatures = (models == null) ? enhancedMethodSignatures : new HashSet<MethodSignature>();
for (AnnotatedMethod<?> method : Beans.getInterceptableMethods(type)) {
enhancedMethodSignatures.add(MethodSignatureImpl.of(method));
if (models != null) {
for (InterceptionModel model : models) {
if (!model.getInterceptors(InterceptionType.AROUND_INVOKE, method.getJavaMember()).isEmpty()) {
interceptedMethodSignatures.add(MethodSignatureImpl.of(method));
break;
}
}
}
}
Set<Type> types = null;
if (bean == null) {
types = Collections.<Type>singleton(type.getJavaClass());
} else {
types = bean.getTypes();
}
return new InterceptedSubclassFactory<T>(manager.getContextId(), type.getJavaClass(), types, bean, enhancedMethodSignatures, interceptedMethodSignatures).getProxyClass();
}
use of org.jboss.weld.interceptor.spi.model.InterceptionModel in project wildfly by wildfly.
the class WeldInterceptorBindingsService method getInterceptorBindings.
private InterceptorBindings getInterceptorBindings(final String ejbName, final BeanManagerImpl manager) {
InterceptorBindings retVal = null;
if (ejbName != null) {
retVal = interceptorSupport.getInterceptorBindings(ejbName, manager);
} else {
// This is a managed bean
SlimAnnotatedType<?> type = (SlimAnnotatedType<?>) manager.createAnnotatedType(componentClass);
if (!manager.getInterceptorModelRegistry().containsKey(type)) {
EnhancedAnnotatedType<?> enhancedType = manager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(type);
InterceptionModelInitializer.of(manager, enhancedType, null).init();
}
InterceptionModel model = manager.getInterceptorModelRegistry().get(type);
if (model != null) {
retVal = new InterceptorBindingsAdapter(manager.getInterceptorModelRegistry().get(type));
}
}
return retVal != null ? retVal : NullInterceptorBindings.INSTANCE;
}
Aggregations