Record Class LegacyAggregateAdapter

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.LegacyAggregateAdapter
Record Components:
aggregate - The legacy Aggregate instance being adapted.
All Implemented Interfaces:
AggregationType

public record LegacyAggregateAdapter(Aggregate aggregate) extends Record implements AggregationType
Adapter class for legacy aggregate types to the AggregationType interface.

This record wraps an Aggregate instance and provides implementations for the AggregationType interface methods. It allows legacy aggregates to be used in contexts requiring the AggregationType interface.

  • Constructor Details

    • LegacyAggregateAdapter

      public LegacyAggregateAdapter(Aggregate aggregate)
      Creates an instance of a LegacyAggregateAdapter record class.
      Parameters:
      aggregate - the value for the aggregate record component
  • Method Details

    • of

      public static LegacyAggregateAdapter of(Aggregate legacy)
      Creates a new LegacyAggregateAdapter for the given legacy aggregate.
      Parameters:
      legacy - The legacy Aggregate instance to adapt.
      Returns:
      A new LegacyAggregateAdapter instance.
    • identifier

      public int identifier()
      Retrieves the identifier of the aggregate.
      Specified by:
      identifier in interface AggregationType
      Returns:
      The unique identifier of the aggregate.
    • name

      public String name()
      Retrieves the name of the aggregate.
      Specified by:
      name in interface AggregationType
      Returns:
      The name of the aggregate.
    • description

      public LocalizedString description()
      Retrieves the description of the aggregate as a localized string.
      Specified by:
      description in interface AggregationType
      Returns:
      A LocalizedString representing the description of the aggregate.
    • dataType

      public Optional<DataType> dataType()
      Retrieves the data type of the aggregate.

      This implementation always returns an empty Optional, as the data type is not applicable for legacy aggregates.

      Specified by:
      dataType in interface AggregationType
      Returns:
      An empty Optional indicating no data type is available.
    • 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.
    • aggregate

      public Aggregate aggregate()
      Returns the value of the aggregate record component.
      Returns:
      the value of the aggregate record component