Record Class AggregatedDataPoint<V,A extends AggregationType>
java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.AggregatedDataPoint<V,A>
- Type Parameters:
V- The type of the value contained in the aggregated data point.A- The type of the aggregation, extendingAggregationType.
- All Implemented Interfaces:
AggregatedPoint<V,,A> DataPoint<V>,SnapshotCapable,TemporalPoint<V,,DataPointType> Comparable<TemporalPoint<V,DataPointType>>
public record AggregatedDataPoint<V,A extends AggregationType> (V value, QualityCode quality, Instant timestamp, QualifiedPath source, A extends AggregationType aggregationType, Optional<Instant> snapshotTimestamp)
extends Record
implements AggregatedPoint<V,A>
Represents an aggregated data point with its value, quality, and aggregation information.
This record encapsulates the value, quality, timestamp, source, aggregation type, and an optional
snapshot timestamp of an aggregated data point. It ensures that the source and aggregation type
are not null, assigns a default quality of QualityCode.Good if null, and sets the current
timestamp if none is provided.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAggregatedDataPoint.Builder<V,A extends AggregationType> Builder class for constructingAggregatedDataPointinstances. -
Constructor Summary
ConstructorsConstructorDescriptionAggregatedDataPoint(V value, QualityCode quality, Instant timestamp, QualifiedPath source, A aggregationType, Optional<Instant> snapshotTimestamp) Constructs anAggregatedDataPointinstance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaggregationTyperecord component.static <V,A extends AggregationType>
AggregatedDataPoint.Builder<V,A> builder(QualifiedPath source, A aggregationType) Creates a new builder forAggregatedDataPoint.final booleanIndicates whether some other object is "equal to" this one.static <V,A extends AggregationType>
AggregatedDataPoint<V,A> Creates an aggregated data point from an existing data point.final inthashCode()Returns a hash code value for this object.quality()Returns the value of thequalityrecord component.Returns the value of thesnapshotTimestamprecord component.source()Returns the value of thesourcerecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.withSnapshot(Instant snapshotTime) Creates a new aggregated data point with an updated snapshot timestamp.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.inductiveautomation.historian.common.model.data.AggregatedPoint
typeMethods inherited from interface com.inductiveautomation.historian.common.model.data.DataPoint
valueClassMethods inherited from interface com.inductiveautomation.historian.common.model.data.SnapshotCapable
isSnapshot, withSnapshotMethods inherited from interface com.inductiveautomation.historian.common.model.data.TemporalPoint
compareTo
-
Constructor Details
-
AggregatedDataPoint
public AggregatedDataPoint(V value, QualityCode quality, Instant timestamp, QualifiedPath source, A aggregationType, Optional<Instant> snapshotTimestamp) Constructs anAggregatedDataPointinstance.Validates that the source and aggregation type are not null. If the quality is null, it defaults to
QualityCode.Good. If the timestamp is null, it defaults to the current time.- Throws:
NullPointerException- If the source or aggregation type is null.
-
-
Method Details
-
builder
public static <V,A extends AggregationType> AggregatedDataPoint.Builder<V,A> builder(QualifiedPath source, A aggregationType) Creates a new builder forAggregatedDataPoint.- Type Parameters:
V- The type of the value.A- The type of the aggregation, extendingAggregationType.- Parameters:
source- The source of the data point. Must not be null.aggregationType- The type of aggregation. Must not be null.- Returns:
- A new
AggregatedDataPoint.Builderinstance for constructingAggregatedDataPointobjects.
-
from
public static <V,A extends AggregationType> AggregatedDataPoint<V,A> from(DataPoint<V> point, A aggregationType) Creates an aggregated data point from an existing data point.- Type Parameters:
V- The type of the value.A- The type of the aggregation, extendingAggregationType.- Parameters:
point- The source data point. Must not be null.aggregationType- The type of aggregation. Must not be null.- Returns:
- A new
AggregatedDataPointinstance based on the provided data point and aggregation type.
-
withSnapshot
Creates a new aggregated data point with an updated snapshot timestamp.- Specified by:
withSnapshotin interfaceSnapshotCapable- Parameters:
snapshotTime- The new snapshot timestamp. Must not be null.- Returns:
- A new
AggregatedDataPointinstance with the updated snapshot timestamp.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
value
Returns the value of thevaluerecord component.- Specified by:
valuein interfaceDataPoint<V>- Specified by:
valuein interfaceTemporalPoint<V,A extends AggregationType> - Returns:
- the value of the
valuerecord component
-
quality
Returns the value of thequalityrecord component. -
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceTemporalPoint<V,A extends AggregationType> - Returns:
- the value of the
timestamprecord component
-
source
Returns the value of thesourcerecord component.- Specified by:
sourcein interfaceTemporalPoint<V,A extends AggregationType> - Returns:
- the value of the
sourcerecord component
-
aggregationType
Returns the value of theaggregationTyperecord component.- Specified by:
aggregationTypein interfaceAggregatedPoint<V,A extends AggregationType> - Returns:
- the value of the
aggregationTyperecord component
-
snapshotTimestamp
Returns the value of thesnapshotTimestamprecord component.- Specified by:
snapshotTimestampin interfaceSnapshotCapable- Returns:
- the value of the
snapshotTimestamprecord component
-