Record Class PersistentDataBundle<T extends PersistentData>

java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.gateway.storeforward.data.PersistentDataBundle<T>
Type Parameters:
T - type of PersistentData elements
Record Components:
storageId - identifies the target storage destination
data - the list of PersistentData to be stored
All Implemented Interfaces:
PersistentData

public record PersistentDataBundle<T extends PersistentData>(StorageId storageId, List<T extends PersistentData> data) extends Record implements PersistentData
Associates PersistentData with a specific storage destination within an engine. This wrapper enables explicit routing of data to specific storage sinks when multiple sinks of the same flavor exist within an engine.
  • Constructor Details

    • PersistentDataBundle

      public PersistentDataBundle(StorageId storageId, List<T> data)
      Constructs a new PersistentDataBundle instance with validation.
      Throws:
      IllegalArgumentException - if storageId is null or data is null/empty
  • Method Details

    • of

      @SafeVarargs public static <T extends PersistentData> PersistentDataBundle<T> of(StorageId storageId, T... data)
      Creates a new PersistentDataBundle instance with multiple data items.
      Type Parameters:
      T - type of PersistentData elements
      Parameters:
      storageId - the storage destination
      data - varargs of PersistentData items
      Returns:
      new PersistentDataBundle instance
    • of

      @SafeVarargs public static <T extends PersistentData> PersistentDataBundle<T> of(String engineId, T... data)
      Creates a new PersistentDataBundle instance with multiple data items.
      Type Parameters:
      T - type of PersistentData elements
      Parameters:
      engineId - the engine id
      data - varargs of PersistentData items
      Returns:
      new PersistentDataBundle instance
    • ofList

      public static <T extends PersistentData> PersistentDataBundle<T> ofList(StorageId storageId, List<T> dataList)
      Creates a new PersistentDataBundle instance from a list of PersistentData items.
      Type Parameters:
      T - type of PersistentData elements
      Parameters:
      storageId - the storage destination
      dataList - the list of PersistentData items to store
      Returns:
      new PersistentDataBundle instance
      Throws:
      IllegalArgumentException - if dataList is null or empty
    • ofList

      public static <T extends PersistentData> PersistentDataBundle<T> ofList(String engineId, List<T> dataList)
      Creates a new PersistentDataBundle instance from a list of PersistentData items.
      Type Parameters:
      T - type of PersistentData elements
      Parameters:
      engineId - the engine id
      dataList - the list of PersistentData items to store
      Returns:
      new PersistentDataBundle instance
      Throws:
      IllegalArgumentException - if dataList is null or empty
    • getFlavor

      @NotNull public @NotNull PersistentFlavor<T> getFlavor()
      Description copied from interface: PersistentData
      Retrieves the PersistentFlavor associated with this kind of persistent data.
      Specified by:
      getFlavor in interface PersistentData
      Returns:
      a PersistentFlavor object
    • getDataCount

      public int getDataCount()
      Description copied from interface: PersistentData
      Returns the count of data elements. Default implementation assumes there's always at least one data element.
      Specified by:
      getDataCount in interface PersistentData
      Returns:
      the count of data elements
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • storageId

      public StorageId storageId()
      Returns the value of the storageId record component.
      Returns:
      the value of the storageId record component
    • data

      public List<T> data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component