Interface EventTypeInterface

  • All Superinterfaces:
    Serializable
    All Known Subinterfaces:
    TimedEventTypeInterface
    All Known Implementing Classes:
    AbstractEventType, EventType, TimedEventType

    public interface EventTypeInterface
    extends Serializable
    The EventTypeInteface is the description of a topic used for the subscription to asynchronous events. Event types are used by EventProducers to show which events they potentially fire. EventTypes are typically defined as static final fields. In order to prevent name clashes for the EventType, the full name of the class from which the EventType was defined (usually in the <clinit>) is added to the equals() and hashCode() methods of the EventType. In that way, EventTypes that are the same will be unique, but implementations of EventTypeInterface that have the same name but are defined in different classes will be different. This is the interface that all event types must implement.

    Note: the reason why this is important is because remote events that use EventTypes can have multiple versions of the same public static final EventType: one the is defined in the client, and one that is defined via the network. These will have different addresses in memory but they share the same class and name info, so equals() will yield true.

    Copyright (c) 2002-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html. This class was originally part of the DSOL project, see https://simulation.tudelft.nl/dsol/manual.

    Author:
    Peter Jacobs , Alexander Verbraeck
    • Method Detail

      • getName

        String getName()
        Return the event type name.
        Returns:
        String; the event type name
      • getMetaData

        MetaData getMetaData()
        Retrieve the MetaData that describes the payload of events of this EventType.
        Returns:
        MetaData; describes the payload of events of this EventType
      • getValidEventType

        Class<? extends EventInterface> getValidEventType()
        Retrieve the event type that defines valid events of this EventType, e.g., to indicate a TimedEvent is expected.
        Returns:
        Class<EventTypeInterface>; the class of valid events of this event type