Record Class AnnotationChangePoint

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.AnnotationChangePoint
Record Components:
identifier - A unique UUID identifying the annotation change. Must not be null.
source - The QualifiedPath representing the source of the annotation. Must not be null.
timestamp - The Instant representing the timestamp of the change. Defaults to the current time if null.
value - The AnnotationPoint value of the annotation change, or null if it represents a deletion.
All Implemented Interfaces:
ChangePoint<AnnotationPoint>, TemporalPoint<AnnotationPoint,ChangePointType>, Comparable<TemporalPoint<AnnotationPoint,ChangePointType>>

public record AnnotationChangePoint(UUID identifier, QualifiedPath source, Instant timestamp, @Nullable AnnotationPoint value) extends Record implements ChangePoint<AnnotationPoint>
Represents a change point for annotation changes.

This record implements ChangePoint with a value type of AnnotationPoint. It encapsulates metadata and temporal information about an annotation change, including its identifier, source, timestamp, and the new annotation value. If the value is null, it represents a deletion.

  • Constructor Details

    • AnnotationChangePoint

      public AnnotationChangePoint(UUID identifier, QualifiedPath source, Instant timestamp, @Nullable AnnotationPoint value)
      Constructs an AnnotationChangePoint instance.

      Validates that the required fields are not null and ensures that the identifier matches the value's identifier if the value is not null.

      Parameters:
      identifier - The identifier associated with this annotation. Must not be null.
      source - The source associated with the annotation. Must not be null.
      value - The new annotation value, or null for deletion.
      Throws:
      NullPointerException - If identifier or source is null.
      IllegalArgumentException - If the value's identifier does not match the provided identifier.
  • Method Details

    • type

      public StandardChangePointType type()
      Retrieves the type of the annotation change point.

      By default, this method returns StandardChangePointType.ANNOTATION_CHANGE.

      Specified by:
      type in interface ChangePoint<AnnotationPoint>
      Specified by:
      type in interface TemporalPoint<AnnotationPoint,ChangePointType>
      Returns:
      The StandardChangePointType of the annotation change point.
    • withSource

      public AnnotationChangePoint withSource(QualifiedPath source)
      Creates a new AnnotationChangePoint with the specified source.

      If the source is the same as the current source, the existing instance is returned.

      Parameters:
      source - The new QualifiedPath source.
      Returns:
      A new AnnotationChangePoint with the updated source, or the current instance if unchanged.
    • updatedAnnotationPoint

      @Nullable public AnnotationPoint updatedAnnotationPoint()
      Retrieves the updated annotation point.
      Returns:
      The AnnotationPoint representing the updated annotation, or null if it represents a deletion.
    • update

      public static AnnotationChangePoint update(UUID identifier, QualifiedPath source, Instant timestamp, AnnotationPoint newValue)
      Creates an annotation update change point.

      This factory method constructs a new AnnotationChangePoint representing an update with the specified identifier, source, timestamp, and new annotation value.

      Parameters:
      identifier - The identifier associated with the annotation. Must not be null.
      source - The source path associated with the annotation. Must not be null.
      timestamp - The timestamp of the update. Must not be null.
      newValue - The new annotation value. Must not be null.
      Returns:
      A new AnnotationChangePoint representing an update.
    • delete

      public static AnnotationChangePoint delete(UUID identifier, QualifiedPath source, Instant timestamp)
      Creates an annotation deletion change point.

      This factory method constructs a new AnnotationChangePoint representing a deletion with the specified identifier, source, and timestamp.

      Parameters:
      identifier - The identifier associated with the annotation. Must not be null.
      source - The source path associated with the annotation. Must not be null.
      timestamp - The timestamp of the deletion. Must not be null.
      Returns:
      A new AnnotationChangePoint representing a deletion.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • identifier

      public UUID identifier()
      Returns the value of the identifier record component.
      Returns:
      the value of the identifier record component
    • source

      public QualifiedPath source()
      Returns the value of the source record component.
      Specified by:
      source in interface TemporalPoint<AnnotationPoint,ChangePointType>
      Returns:
      the value of the source record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TemporalPoint<AnnotationPoint,ChangePointType>
      Returns:
      the value of the timestamp record component
    • value

      @Nullable public AnnotationPoint value()
      Returns the value of the value record component.
      Specified by:
      value in interface ChangePoint<AnnotationPoint>
      Specified by:
      value in interface TemporalPoint<AnnotationPoint,ChangePointType>
      Returns:
      the value of the value record component