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 is `null`, 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()` |

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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 be `null` if `eventType` is `OBJECT_REMOVED`.
      `previousObjectState` - The previous state of the object for which this event was created.Value is irrelevant/may be `null` if `eventType` is `OBJECT_CREATED`.
      `eventType` - The event's type.
    Throws:
      `java.lang.NullPointerException` - If `eventType` is `null`.
      `java.lang.IllegalArgumentException` - If either `currentObjectState` or `previousObjectState` is `null` while `eventType` does not have an appropriate value.

- ## Method Details

  - ### getCurrentObjectState

    public TCSObject<?> 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

    public TCSObject<?> 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

    public TCSObject<?> getCurrentOrPreviousObjectState()
    Returns the current state of the object for which this event was created, or, if the current state is `null`, the previous state.
    Returns:
      The current or the previous state of the object for which this event was created.

  - ### getType

    public TCSObjectEvent.Type getType()
    Returns this event's type.
    Returns:
      This event's type.

  - ### toString

    public java.lang.String toString()
    Overrides:
      `toString` in class `java.lang.Object`