Package org.opentcs.components.kernel.services

# Interface TCSObjectService

All Known Subinterfaces:
  `InternalPeripheralJobService`, `InternalPeripheralService`, `InternalPlantModelService`, `InternalTransportOrderService`, `InternalVehicleService`, `PeripheralJobService`, `PeripheralService`, `PlantModelService`, `TransportOrderService`, `VehicleService`

    public interface TCSObjectService

Provides methods concerning `TCSObject`s.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `appendObjectHistoryEntry​(TCSObjectReference<?> ref, ObjectHistory.Entry entry)` | Appends a history entry to a `TCSObject`.
  `<T extends TCSObject<T>> T` | `fetchObject​(java.lang.Class<T> clazz, java.lang.String name)` | Returns a single `TCSObject` of the given class.
  `<T extends TCSObject<T>> T` | `fetchObject​(java.lang.Class<T> clazz, TCSObjectReference<T> ref)` | Returns a single `TCSObject` of the given class.
  `<T extends TCSObject<T>> java.util.Set<T>` | `fetchObjects​(java.lang.Class<T> clazz)` | Returns all existing `TCSObject`s of the given class.
  `<T extends TCSObject<T>> java.util.Set<T>` | `fetchObjects​(java.lang.Class<T> clazz, java.util.function.Predicate<? super T> predicate)` | Returns all existing `TCSObject`s of the given class for which the given predicate is true.
  `void` | `updateObjectProperty​(TCSObjectReference<?> ref, java.lang.String key, java.lang.String value)` | Updates a `TCSObject`'s property.

- ## Method Details

  - ### fetchObject

    <T extends TCSObject<T>> T fetchObject​(java.lang.Class<T> clazz, TCSObjectReference<T> ref) throws KernelRuntimeException
    Returns a single `TCSObject` of the given class.
    Type Parameters:
      `T` - The TCSObject's actual type.
    Parameters:
      `clazz` - The class of the object to be returned.
      `ref` - A reference to the object to be returned.
    Returns:
      A copy of the referenced object, or `null` if no such object exists or if an object exists but is not an instance of the given class.
    Throws:
      `KernelRuntimeException` - In case there is an exception executing this method.

  - ### fetchObject

    <T extends TCSObject<T>> T fetchObject​(java.lang.Class<T> clazz, java.lang.String name) throws KernelRuntimeException
    Returns a single `TCSObject` of the given class.
    Type Parameters:
      `T` - The TCSObject's actual type.
    Parameters:
      `clazz` - The class of the object to be returned.
      `name` - The name of the object to be returned.
    Returns:
      A copy of the named object, or `null` if no such object exists or if an object exists but is not an instance of the given class.
    Throws:
      `KernelRuntimeException` - In case there is an exception executing this method.

  - ### fetchObjects

    <T extends TCSObject<T>> java.util.Set<T> fetchObjects​(java.lang.Class<T> clazz) throws KernelRuntimeException
    Returns all existing `TCSObject`s of the given class.
    Type Parameters:
      `T` - The TCSObjects' actual type.
    Parameters:
      `clazz` - The class of the objects to be returned.
    Returns:
      Copies of all existing objects of the given class.
    Throws:
      `KernelRuntimeException` - In case there is an exception executing this method.

  - ### fetchObjects

    <T extends TCSObject<T>> java.util.Set<T> fetchObjects​(@Nonnull java.lang.Class<T> clazz, @Nonnull java.util.function.Predicate<? super T> predicate) throws KernelRuntimeException
    Returns all existing `TCSObject`s of the given class for which the given predicate is true.
    Type Parameters:
      `T` - The TCSObjects' actual type.
    Parameters:
      `clazz` - The class of the objects to be returned.
      `predicate` - The predicate that must be true for returned objects.
    Returns:
      Copies of all existing objects of the given class for which the given predicate is true. If no such objects exist, the returned set will be empty.
    Throws:
      `KernelRuntimeException` - In case there is an exception executing this method.

  - ### updateObjectProperty

    void updateObjectProperty​(TCSObjectReference<?> ref, java.lang.String key, @Nullable java.lang.String value) throws ObjectUnknownException, KernelRuntimeException
    Updates a `TCSObject`'s property.
    Parameters:
      `ref` - A reference to the TCSObject to be modified.
      `key` - The property's key.
      `value` - The property's (new) value. If `null`, removes the property from the object.
    Throws:
      `ObjectUnknownException` - If the referenced object does not exist.
      `KernelRuntimeException` - In case there is an exception executing this method.

  - ### appendObjectHistoryEntry

    void appendObjectHistoryEntry​(TCSObjectReference<?> ref, ObjectHistory.Entry entry) throws ObjectUnknownException, KernelRuntimeException
    Appends a history entry to a `TCSObject`.
    Parameters:
      `ref` - A reference to the TCSObject to be modified.
      `entry` - The history entry to be appended.
    Throws:
      `ObjectUnknownException` - If the referenced object does not exist.
      `KernelRuntimeException` - In case there is an exception executing this method.