Package org.djutils.event
Class EventType
java.lang.Object
org.djutils.event.EventType
- All Implemented Interfaces:
Serializable
public final class EventType extends Object implements Serializable
The EventType is a masker used for the subscription to asynchronous events. Eventtypes are used by EventProducers to show
which events they potentially fire. EventTypes should be 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
EventTypes with just the same name but defined in different classes will be different.
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.
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-2020 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
- See Also:
- Serialized Form
-
Constructor Details
-
EventType
Construct a new EventType.- Parameters:
name
- String; the name of this eventType. Two values are not appreciated: null and the empty string.
-
-
Method Details