use of org.jboss.weld.util.bean.ForwardingBeanAttributes in project core by weld.
the class ProbeExtension method processBeanAttributes.
public <T> void processBeanAttributes(@Observes ProcessBeanAttributes<T> event, BeanManager beanManager) {
probe.getBootstrapStats().increment(EventType.PBA);
final BeanAttributes<T> beanAttributes = event.getBeanAttributes();
final WeldManager weldManager = (WeldManager) beanManager;
if (isMonitored(event.getAnnotated(), beanAttributes, weldManager)) {
event.setBeanAttributes(new ForwardingBeanAttributes<T>() {
@Override
public Set<Class<? extends Annotation>> getStereotypes() {
return ImmutableSet.<Class<? extends Annotation>>builder().addAll(attributes().getStereotypes()).add(MonitoredComponent.class).build();
}
@Override
protected BeanAttributes<T> attributes() {
return beanAttributes;
}
@Override
public String toString() {
return beanAttributes.toString();
}
});
ProbeLogger.LOG.monitoringStereotypeAdded(event.getAnnotated());
}
if (eventMonitorContainerLifecycleEvents) {
addContainerLifecycleEvent(event, "Types: [" + Formats.formatTypes(event.getBeanAttributes().getTypes()) + "], qualifiers: [" + Formats.formatAnnotations(event.getBeanAttributes().getQualifiers()) + "]", beanManager);
}
}
Aggregations