Package org.opentcs.data
Class TCSObjectEvent
java.lang.Object
org.opentcs.data.TCSObjectEvent
- All Implemented Interfaces:
java.io.Serializable
public class TCSObjectEvent
extends java.lang.Object
implements java.io.Serializable
Instances of this class represent events emitted by/for business objects.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TCSObjectEvent.Type
Indicates the type of an event, which can be helpful with filtering events. -
Constructor Summary
Constructors Constructor Description TCSObjectEvent(TCSObject<?> currentObjectState, TCSObject<?> previousObjectState, TCSObjectEvent.Type eventType)
Creates a new TCSObjectEvent. -
Method Summary
Modifier and Type Method Description TCSObject<?>
getCurrentObjectState()
Returns the current state of the object for which this event was created.TCSObject<?>
getCurrentOrPreviousObjectState()
Returns the current state of the object for which this event was created, or, if the current state isnull
, the previous state.TCSObject<?>
getPreviousObjectState()
Returns the previous state of the object for which this event was created.TCSObjectEvent.Type
getType()
Returns this event's type.java.lang.String
toString()
-
Constructor Details
-
TCSObjectEvent
public TCSObjectEvent(TCSObject<?> currentObjectState, TCSObject<?> previousObjectState, TCSObjectEvent.Type eventType)Creates a new TCSObjectEvent.- Parameters:
currentObjectState
- The current state of the object for which this event was created. Value is irrelevant/may benull
ifeventType
isOBJECT_REMOVED
.previousObjectState
- The previous state of the object for which this event was created.Value is irrelevant/may benull
ifeventType
isOBJECT_CREATED
.eventType
- The event's type.- Throws:
java.lang.NullPointerException
- IfeventType
isnull
.java.lang.IllegalArgumentException
- If eithercurrentObjectState
orpreviousObjectState
isnull
whileeventType
does not have an appropriate value.
-
-
Method Details
-
getCurrentObjectState
Returns the current state of the object for which this event was created.- Returns:
- The current state of the object for which this event was created.
-
getPreviousObjectState
Returns the previous state of the object for which this event was created.- Returns:
- The previous state of the object for which this event was created.
-
getCurrentOrPreviousObjectState
Returns the current state of the object for which this event was created, or, if the current state isnull
, the previous state.- Returns:
- The current or the previous state of the object for which this event was created.
-
getType
Returns this event's type.- Returns:
- This event's type.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-