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 class
AggregatedDataPoint.Builder<V,
A extends AggregationType> Builder class for constructingAggregatedDataPoint
instances. -
Constructor Summary
ConstructorsConstructorDescriptionAggregatedDataPoint
(V value, QualityCode quality, Instant timestamp, QualifiedPath source, A aggregationType, Optional<Instant> snapshotTimestamp) Constructs anAggregatedDataPoint
instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaggregationType
record component.static <V,
A extends AggregationType>
AggregatedDataPoint.Builder<V,A> builder
(QualifiedPath source, A aggregationType) Creates a new builder forAggregatedDataPoint
.final boolean
Indicates 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 int
hashCode()
Returns a hash code value for this object.quality()
Returns the value of thequality
record component.Returns the value of thesnapshotTimestamp
record component.source()
Returns the value of thesource
record component.Returns the value of thetimestamp
record component.final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record 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, wait
Methods inherited from interface com.inductiveautomation.historian.common.model.data.AggregatedPoint
type
Methods inherited from interface com.inductiveautomation.historian.common.model.data.DataPoint
valueClass
Methods inherited from interface com.inductiveautomation.historian.common.model.data.SnapshotCapable
isSnapshot, withSnapshot
Methods 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 anAggregatedDataPoint
instance.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.Builder
instance for constructingAggregatedDataPoint
objects.
-
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
AggregatedDataPoint
instance based on the provided data point and aggregation type.
-
withSnapshot
Creates a new aggregated data point with an updated snapshot timestamp.- Specified by:
withSnapshot
in interfaceSnapshotCapable
- Parameters:
snapshotTime
- The new snapshot timestamp. Must not be null.- Returns:
- A new
AggregatedDataPoint
instance 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 thevalue
record component.- Specified by:
value
in interfaceDataPoint<V>
- Specified by:
value
in interfaceTemporalPoint<V,
A extends AggregationType> - Returns:
- the value of the
value
record component
-
quality
Returns the value of thequality
record component. -
timestamp
Returns the value of thetimestamp
record component.- Specified by:
timestamp
in interfaceTemporalPoint<V,
A extends AggregationType> - Returns:
- the value of the
timestamp
record component
-
source
Returns the value of thesource
record component.- Specified by:
source
in interfaceTemporalPoint<V,
A extends AggregationType> - Returns:
- the value of the
source
record component
-
aggregationType
Returns the value of theaggregationType
record component.- Specified by:
aggregationType
in interfaceAggregatedPoint<V,
A extends AggregationType> - Returns:
- the value of the
aggregationType
record component
-
snapshotTimestamp
Returns the value of thesnapshotTimestamp
record component.- Specified by:
snapshotTimestamp
in interfaceSnapshotCapable
- Returns:
- the value of the
snapshotTimestamp
record component
-