Search in sources :

Example 6 with EventMetadata

use of javax.enterprise.inject.spi.EventMetadata in project core by weld.

the class BeanManagerImpl method fireEvent.

/**
 * Fires an event object with given event object for given bindings
 *
 * @param event The event object to pass along
 * @param qualifiers The binding types to match
 * @see javax.enterprise.inject.spi.BeanManager#fireEvent(java.lang.Object, java.lang.annotation.Annotation[])
 */
@Override
public void fireEvent(Object event, Annotation... qualifiers) {
    Preconditions.checkArgumentNotNull(event, "event");
    Type eventType = Types.getCanonicalType(event.getClass());
    EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers);
    globalStrictObserverNotifier.fireEvent(event, metadata, qualifiers);
}
Also used : SlimAnnotatedType(org.jboss.weld.annotated.slim.SlimAnnotatedType) AnnotatedType(javax.enterprise.inject.spi.AnnotatedType) Type(java.lang.reflect.Type) EnhancedAnnotatedType(org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType) AnnotatedTypeValidator.validateAnnotatedType(org.jboss.weld.annotated.AnnotatedTypeValidator.validateAnnotatedType) InterceptionType(javax.enterprise.inject.spi.InterceptionType) EventMetadataImpl(org.jboss.weld.event.EventMetadataImpl) EventMetadata(javax.enterprise.inject.spi.EventMetadata)

Example 7 with EventMetadata

use of javax.enterprise.inject.spi.EventMetadata in project core by weld.

the class EventImpl method createCachedObservers.

private CachedObservers createCachedObservers(Class<?> runtimeType) {
    final Type eventType = getEventType(runtimeType);
    // this performs type check
    final ResolvedObservers<T> observers = getBeanManager().getGlobalStrictObserverNotifier().resolveObserverMethods(eventType, getQualifiers());
    final EventMetadata metadata = new EventMetadataImpl(eventType, getInjectionPoint(), getQualifiers());
    return new CachedObservers(runtimeType, observers, metadata);
}
Also used : Type(java.lang.reflect.Type) EventMetadata(javax.enterprise.inject.spi.EventMetadata)

Aggregations

EventMetadata (javax.enterprise.inject.spi.EventMetadata)7 Type (java.lang.reflect.Type)3 EventMetadataImpl (org.jboss.weld.event.EventMetadataImpl)3 ObserverMethod (javax.enterprise.inject.spi.ObserverMethod)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletionException (java.util.concurrent.CompletionException)1 CompletionStage (java.util.concurrent.CompletionStage)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Executor (java.util.concurrent.Executor)1 ForkJoinPool (java.util.concurrent.ForkJoinPool)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 TimeUnit (java.util.concurrent.TimeUnit)1 TimeoutException (java.util.concurrent.TimeoutException)1