Package org.djutils.event
Class Event
- java.lang.Object
-
- org.djutils.event.Event
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TimedEvent
public class Event extends Object implements Serializable
The Event class forms the reference implementation for the Event. Because events are often sent over the network, the interface demands that its content are serializable. It is the responsibility of the programmer, though, that the fields of the content are serializable as well.Copyright (c) 2002-2023 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 Summary
Constructors Constructor Description Event(EventType type, Serializable content)Construct a new Event, where compliance with the metadata is verified.Event(EventType type, Serializable content, boolean verifyMetaData)Construct a new Event, with a choice to verify compliance with metadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)SerializablegetContent()Return the content (payload) of this event.EventTypegetType()Return the type of the event.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
Event
public Event(EventType type, Serializable content)
Construct a new Event, where compliance with the metadata is verified.- Parameters:
type- EventType; the name of the Event.content- Serializable; the content of the event
-
Event
public Event(EventType type, Serializable content, boolean verifyMetaData)
Construct a new Event, with a choice to verify compliance with metadata.- Parameters:
type- EventType; the name of the Event.content- Serializable; the content of the eventverifyMetaData- boolean; whether to verify the compliance with metadata or not
-
-
Method Detail
-
getContent
public final Serializable getContent()
Return the content (payload) of this event.- Returns:
- Serializable; the content (payload) of this event
-
getType
public EventType getType()
Return the type of the event.- Returns:
- EventType; the type of the event
-
-