Record Class LegacyAggregateAdapter

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

public record LegacyAggregateAdapter(Aggregate aggregate) extends Record implements AggregationType
Adapts a tag history Aggregate to AggregationType, so it can be used where an AggregationType is required.
  • 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)
      Adapts the given aggregate.
      Parameters:
      legacy - the aggregate to adapt.
      Returns:
      the adapter.
    • id

      public AggregateId id()
      Derives the id from the aggregate's name in lower snake case: "MinMax" becomes "min_max".
      Specified by:
      id in interface AggregationType
      Returns:
      the id.
    • tryId

      public Optional<AggregateId> tryId()
      Returns id(), or empty when the name is absent or outside AggregateId.Core's slug grammar, as a custom provider-defined aggregate's may be.
    • name

      public String name()
      Returns the aggregate's name.
      Specified by:
      name in interface AggregationType
      Returns:
      the name.
    • description

      public LocalizedString description()
      Returns the aggregate's localized description.
      Specified by:
      description in interface AggregationType
      Returns:
      the description.
    • acceptedInputTypes

      public Set<DataType> acceptedInputTypes()
      Returns the interface default widened by the matching standard aggregate's set, so Count, LastValue, PctGood and PctBad take every type.
      Specified by:
      acceptedInputTypes in interface AggregationType
      Returns:
      the accepted input types.
    • dataType

      public Optional<DataType> dataType()
      Always empty, meaning undeclared: tag history aggregation modes carry no type information. Do not read it as the resolved tag type: Count yields a Long, and Variance, StdDev, PctGood and PctBad yield a Double, whatever the tag's type.
      Specified by:
      dataType in interface AggregationType
      Returns:
      an empty optional
    • 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