Record Class RecordSection<T>

java.lang.Object
java.lang.Record
com.eqixiac.equinix.design.record.RecordSection<T>
Type Parameters:
T - the content type
Record Components:
status - whether the section was produced
reason - why it was skipped or failed; null when included
content - the section's content; null unless included

public record RecordSection<T>(RecordSection.Status status, String reason, T content) extends Record
One section of a DesignDecisionRecord: its content, or why there is none.
  • Constructor Details

    • RecordSection

      public RecordSection(RecordSection.Status status, String reason, T content)
      Requires content exactly when included, and a reason otherwise.
  • Method Details

    • included

      public static <T> RecordSection<T> included(T content)
      Type Parameters:
      T - its type
      Parameters:
      content - the content
      Returns:
      an included section
    • skipped

      public static <T> RecordSection<T> skipped(String reason)
      Type Parameters:
      T - the content type
      Parameters:
      reason - why the section has no content
      Returns:
      a skipped section
    • failed

      public static <T> RecordSection<T> failed(String reason)
      Type Parameters:
      T - the content type
      Parameters:
      reason - what failed
      Returns:
      a failed section
    • isIncluded

      public boolean isIncluded()
      Returns:
      true when the section has content
    • 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.
    • status

      public RecordSection.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • content

      public T content()
      Returns the value of the content record component.
      Returns:
      the value of the content record component