Record Class SourceChangePoint
java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.SourceChangePoint
- Record Components:
value- the old and new source paths.timestamp- when the change occurred.
- 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>
A change to a source: a rename from an old path to a new one, or a retirement of the old path.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe old and new source paths of a source change. -
Constructor Summary
ConstructorsConstructorDescriptionSourceChangePoint(SourceChangePoint.SourceMapKey value, Instant timestamp) Creates a point. -
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.booleanReturns whether this change retires the source; equivalent toisRetirement().booleanReturns whether this change retires the source, meaning the new source is null.static SourceChangePointmerge(@Nullable SourceChangePoint earlier, SourceChangePoint later) Returns the net effect ofearlierfollowed bylater, soA->BthenB->CbecomesA->C, withlater's timestamp.Returns the new source path.Returns the old source path.static SourceChangePointretirement(QualifiedPath oldSource) Creates a retirement timestamped now.static SourceChangePointretirement(QualifiedPath oldSource, Instant timestamp) Creates a retirement.source()Returns the old source path.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()static SourceChangePointupdate(QualifiedPath oldSource, QualifiedPath newSource) Creates a rename timestamped now.static SourceChangePointupdate(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp) Creates a rename.value()Returns the value of thevaluerecord component.Methods inherited from interface TemporalPoint
compareTo
-
Constructor Details
-
SourceChangePoint
Creates a point. A null timestamp defaults to now.- Parameters:
value- the change; must not be null.timestamp- the time of the change.
-
-
Method Details
-
source
Returns the old source path.- Specified by:
sourcein interfaceTemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>- Returns:
- the old source.
-
type
- Specified by:
typein interfaceChangePoint<SourceChangePoint.SourceMapKey>- Specified by:
typein interfaceTemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>- Returns:
- the point type.
-
oldSource
-
newSource
Returns the new source path.- Returns:
- the new source, or
nullfor a retirement.
-
isRetirement
public boolean isRetirement()Returns whether this change retires the source, meaning the new source is null.- Returns:
truefor a retirement.
-
isDeletion
public boolean isDeletion()Returns whether this change retires the source; equivalent toisRetirement().- Specified by:
isDeletionin interfaceChangePoint<SourceChangePoint.SourceMapKey>- Returns:
truefor a retirement.
-
retirement
Creates a retirement timestamped now.- Parameters:
oldSource- the source being retired; must not be null.- Returns:
- the new point.
-
retirement
Creates a retirement.- Parameters:
oldSource- the source being retired; must not be null.timestamp- the time of the retirement; must not be null.- Returns:
- the new point.
-
update
Creates a rename timestamped now.- Parameters:
oldSource- the old path; must not be null.newSource- the new path; must not be null.- Returns:
- the new point.
-
update
public static SourceChangePoint update(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp) Creates a rename.- Parameters:
oldSource- the old path; must not be null.newSource- the new path; must not be null.timestamp- the time of the rename; must not be null.- Returns:
- the new point.
-
merge
Returns the net effect ofearlierfollowed bylater, soA->BthenB->CbecomesA->C, withlater's timestamp. Iflateris a retirement, the result retiresearlier.oldSource(). Ifearlierisnull, returnslater.The changes must form a chain,
earlier.newSource()equal tolater.oldSource(); merging unrelated changes silently dropslater.oldSource().- Parameters:
earlier- the prior change in the chain, ornull.later- the next change in the chain; must not benull.- Returns:
- the merged change.
-
toString
-
hashCode
-
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
-