1 package org.djutils.event;
2
3 import org.djutils.metadata.MetaData;
4
5 /**
6 * The TimedEventType is the description of a topic used for the subscription to asynchronous events with a time stamp. Event
7 * types are used by EventProducers to show which events they potentially fire. EventTypes are typically defined as static final
8 * fields. This class only accepts when the producer fires events of type TimedEvent, and not a generic Event or subclass of
9 * TimedEvent. <br>
10 * <br>
11 * Copyright (c) 2020-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12 * for project information <a href="https://djutils.org" target="_blank"> https://djutils.org</a>. The DJUTILS project is
13 * distributed under a three-clause BSD-style license, which can be found at
14 * <a href="https://djutils.org/docs/license.html" target="_blank"> https://djutils.org/docs/license.html</a>. <br>
15 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16 * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17 */
18 public class TimedEventType extends AbstractEventType implements TimedEventTypeInterface
19 {
20 /** */
21 private static final long serialVersionUID = 20200505L;
22
23 /**
24 * Construct a new TimedEventType. Only events of the type TimedEvent, but not classes of Event or subclasses of TimedEvent,
25 * can be used to fire events of this type. This means that firing an ordinary Event using this EventType will result in an
26 * error.
27 * @param name String; the name of the new eventType. Two values are not appreciated: null and the empty string.
28 * @param metaData MetaData; describes the payload of events of the new EventType;
29 */
30 public TimedEventType(final String name, final MetaData metaData)
31 {
32 super(name, metaData, TimedEvent.class);
33 }
34
35 /**
36 * Construct a new TimedEventType. The name of the metadata will function as the name of the event. Only events of the type
37 * TimedEvent, but not classes of Event or subclasses of TimedEvent, can be used to fire events of this type. This means
38 * that firing an ordinary Event using this EventType will result in an error.
39 * @param metaData MetaData; describes the payload of events of the new EventType;
40 */
41 public TimedEventType(final MetaData metaData)
42 {
43 super(metaData == null ? null : metaData.getName(), metaData, TimedEvent.class);
44 }
45
46 /**
47 * Construct a new TimedEventType with no meta data. Only events of the type TimedEvent, but not classes of Event or
48 * subclasses of TimedEvent, can be used to fire events of this type. This means that firing an ordinary Event using this
49 * EventType will result in an error.
50 * @param name String; the name of the new eventType. Two values are not appreciated: null and the empty string.
51 */
52 @Deprecated
53 public TimedEventType(final String name)
54 {
55 super(name, MetaData.NO_META_DATA, TimedEvent.class);
56 }
57
58 }