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 recordRepresents the value of a source change. -
Constructor Summary
ConstructorsConstructorDescriptionSourceChangePoint(SourceChangePoint.SourceMapKey value, Instant timestamp) Constructs aSourceChangePointwith null checks and a default timestamp. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if this change represents a deletion.booleanChecks if this change represents a retirement.Retrieves the new source path of the change.Retrieves the old source path of the change.static SourceChangePointretirement(QualifiedPath oldSource) Creates a retirement change point with the current timestamp.static SourceChangePointretirement(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 thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Retrieves the type of the change point.static SourceChangePointupdate(QualifiedPath oldSource, QualifiedPath newSource) Creates an update change point with the current timestamp.static SourceChangePointupdate(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp) Creates an update change point with a specified timestamp.value()Returns the value of thevaluerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.inductiveautomation.historian.common.model.data.TemporalPoint
compareTo
-
Constructor Details
-
SourceChangePoint
Constructs aSourceChangePointwith 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:
sourcein interfaceTemporalPoint<SourceChangePoint.SourceMapKey,ChangePointType> - Returns:
- The old source path.
-
type
Retrieves the type of the change point.- Specified by:
typein interfaceChangePoint<SourceChangePoint.SourceMapKey>- Specified by:
typein 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:
isDeletionin 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
SourceChangePointrepresenting 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
SourceChangePointrepresenting 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
SourceChangePointrepresenting 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
SourceChangePointrepresenting 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 thevaluerecord component.- Specified by:
valuein interfaceChangePoint<SourceChangePoint.SourceMapKey>- Specified by:
valuein interfaceTemporalPoint<SourceChangePoint.SourceMapKey,ChangePointType> - Returns:
- the value of the
valuerecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceTemporalPoint<SourceChangePoint.SourceMapKey,ChangePointType> - Returns:
- the value of the
timestamprecord component
-