Record Class Annotation

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.Annotation
Record Components:
notes - The notes associated with the annotation. If null, it is converted to an empty string.
type - The type of the annotation. Must not be null.
author - The author of the annotation. Defaults to "unknown" if null.

public record Annotation(String notes, String type, String author) extends Record
Represents an annotation in the historian system.

This record encapsulates metadata about an annotation, including its notes, type, and author. It ensures that the type is not null, assigns a default value of "unknown" to the author if null, and converts the notes to a non-null string representation.

  • Constructor Details

    • Annotation

      public Annotation(String notes, String type, String author)
      Constructs an Annotation instance.

      Validates that the type is not null, assigns a default value to the author if null, and ensures the notes are converted to a non-null string.

      Throws:
      NullPointerException - If the type is null.
  • Method Details

    • 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.
    • notes

      public String notes()
      Returns the value of the notes record component.
      Returns:
      the value of the notes record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • author

      public String author()
      Returns the value of the author record component.
      Returns:
      the value of the author record component