Record Class SourceChangePoint
java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.SourceChangePoint
- All Implemented Interfaces:
ChangePoint<SourceChangePoint.SourceMapKey>
,TemporalPoint<SourceChangePoint.SourceMapKey,
,ChangePointType> Comparable<TemporalPoint<SourceChangePoint.SourceMapKey,
ChangePointType>>
public record SourceChangePoint(SourceChangePoint.SourceMapKey value, Instant timestamp)
extends Record
implements ChangePoint<SourceChangePoint.SourceMapKey>
Represents a change point for source changes.
This record encapsulates the details of a source change, including the value of the change
and the timestamp when the change occurred. It implements the ChangePoint
interface
with SourceChangePoint.SourceMapKey
as the type parameter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Represents the value of a source change. -
Constructor Summary
ConstructorsConstructorDescriptionSourceChangePoint
(SourceChangePoint.SourceMapKey value, Instant timestamp) Constructs aSourceChangePoint
with null checks and a default timestamp. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Checks if this change represents a deletion.boolean
Checks if this change represents a retirement.Retrieves the new source path of the change.Retrieves the old source path of the change.static SourceChangePoint
retirement
(QualifiedPath oldSource) Creates a retirement change point with the current timestamp.static SourceChangePoint
retirement
(QualifiedPath oldSource, Instant timestamp) Creates a retirement change point with a specified timestamp.source()
Retrieves the old source path of the change.Returns the value of thetimestamp
record component.final String
toString()
Returns a string representation of this record class.type()
Retrieves the type of the change point.static SourceChangePoint
update
(QualifiedPath oldSource, QualifiedPath newSource) Creates an update change point with the current timestamp.static SourceChangePoint
update
(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp) Creates an update change point with a specified timestamp.value()
Returns the value of thevalue
record component.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.TemporalPoint
compareTo
-
Constructor Details
-
SourceChangePoint
Constructs aSourceChangePoint
with null checks and a default timestamp.Ensures that the value is not null and assigns the current time as the default timestamp if none is provided.
- Parameters:
value
- The source change value, must not be null.timestamp
- The timestamp of the change, defaults to the current time if null.
-
-
Method Details
-
source
Retrieves the old source path of the change.- Specified by:
source
in interfaceTemporalPoint<SourceChangePoint.SourceMapKey,
ChangePointType> - Returns:
- The old source path.
-
type
Retrieves the type of the change point.- Specified by:
type
in interfaceChangePoint<SourceChangePoint.SourceMapKey>
- Specified by:
type
in interfaceTemporalPoint<SourceChangePoint.SourceMapKey,
ChangePointType> - Returns:
- The type of the change point, which is
StandardChangePointType.SOURCE_CHANGE
.
-
oldSource
Retrieves the old source path of the change.- Returns:
- The old source path.
-
newSource
Retrieves the new source path of the change.- Returns:
- The new source path, or null if this is a retirement.
-
isRetirement
public boolean isRetirement()Checks if this change represents a retirement.- Returns:
- True if the new source is null, indicating a retirement.
-
isDeletion
public boolean isDeletion()Checks if this change represents a deletion.- Specified by:
isDeletion
in interfaceChangePoint<SourceChangePoint.SourceMapKey>
- Returns:
- True if this change represents a retirement (new source is null).
-
retirement
Creates a retirement change point with the current timestamp.- Parameters:
oldSource
- The source being retired, must not be null.- Returns:
- A new
SourceChangePoint
representing the retirement.
-
retirement
Creates a retirement change point with a specified timestamp.- Parameters:
oldSource
- The source being retired, must not be null.timestamp
- The timestamp of the retirement, must not be null.- Returns:
- A new
SourceChangePoint
representing the retirement.
-
update
Creates an update change point with the current timestamp.- Parameters:
oldSource
- The old source path, must not be null.newSource
- The new source path, must not be null.- Returns:
- A new
SourceChangePoint
representing the update.
-
update
public static SourceChangePoint update(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp) Creates an update change point with a specified timestamp.- Parameters:
oldSource
- The old source path, must not be null.newSource
- The new source path, must not be null.timestamp
- The timestamp of the update, must not be null.- Returns:
- A new
SourceChangePoint
representing the update.
-
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 interfaceChangePoint<SourceChangePoint.SourceMapKey>
- Specified by:
value
in interfaceTemporalPoint<SourceChangePoint.SourceMapKey,
ChangePointType> - Returns:
- the value of the
value
record component
-
timestamp
Returns the value of thetimestamp
record component.- Specified by:
timestamp
in interfaceTemporalPoint<SourceChangePoint.SourceMapKey,
ChangePointType> - Returns:
- the value of the
timestamp
record component
-