javax.enterprise.event

Interface Event<T>

  • Type Parameters:
    T - the type of the event object

    public interface Event<T>

    Allows the application to fire events of a particular type.

    Beans fire events via an instance of the Event interface, which may be injected:

     @Inject
     @Any
     Event<LoggedInEvent> loggedInEvent;
     

    The fire() method accepts an event object:

     public void login() { 
        ...
        loggedInEvent.fire( new LoggedInEvent(user) );
     }
     

    Any combination of qualifiers may be specified at the injection point:

     @Inject
     @Admin
     Event<LoggedInEvent> adminLoggedInEvent;
     

    Or, the @Any qualifier may be used, allowing the application to specify qualifiers dynamically:

     @Inject
     @Any
     Event<LoggedInEvent> loggedInEvent;
     

    For an injected Event:

    • the specified type is the type parameter specified at the injection point, and
    • the specified qualifiers are the qualifiers specified at the injection point.
    Author:
    Gavin King, Pete Muir, David Allen
    • Method Detail

      • fire

        void fire(T event)

        Fires an event with the specified qualifiers and notifies observers.

        Parameters:
        event - the event object
        Throws:
        IllegalArgumentException - if the runtime type of the event object contains a type variable
        ObserverException - if a notified observer throws a checked exception, it will be wrapped and rethrown as an (unchecked) ObserverException
      • select

        Event<T> select(Annotation... qualifiers)

        Obtains a child Event for the given additional required qualifiers.

        Parameters:
        qualifiers - the additional specified qualifiers
        Returns:
        the child Event
        Throws:
        IllegalArgumentException - if passed two instances of the same qualifier type, or an instance of an annotation that is not a qualifier type
      • select

        <U extends TEvent<U> select(Class<U> subtype,
                                      Annotation... qualifiers)

        Obtains a child Event for the given required type and additional required qualifiers.

        Type Parameters:
        U - the specified type
        Parameters:
        subtype - a Class representing the specified type
        qualifiers - the additional specified qualifiers
        Returns:
        the child Event
        Throws:
        IllegalArgumentException - if passed two instances of the same qualifier type, or an instance of an annotation that is not a qualifier type
      • select

        <U extends TEvent<U> select(TypeLiteral<U> subtype,
                                      Annotation... qualifiers)

        Obtains a child Event for the given required type and additional required qualifiers.

        Type Parameters:
        U - the specified type
        Parameters:
        subtype - a TypeLiteral representing the specified type
        qualifiers - the additional specified qualifiers
        Returns:
        the child Event
        Throws:
        IllegalArgumentException - if passed two instances of the same qualifier type, or an instance of an annotation that is not a qualifier type

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/enterprise/event/event.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.