Record Class LifecycleRecord

java.lang.Object
java.lang.Record
com.arc_e_tect.gradle.trackerlens.tracker.LifecycleRecord
Record Components:
id - stable identifier for this item, unique within its tracker
label - human-readable display name
group - optional grouping label (e.g. the enclosing feature or declaring class), or null when the source has no grouping concept
stageReachedAt - ordered map of stage name to the instant the item first reached that stage
lastSeenAt - when the item was last observed present, or null if never observed
removedAt - when the item was first observed missing, or null while still present

public record LifecycleRecord(String id, String label, String group, Map<String,Instant> stageReachedAt, Instant lastSeenAt, Instant removedAt) extends Record
A single tracked item's lifecycle, as read from a TrackerSource.

stageReachedAt is ordered by the tracker's canonical stage sequence (e.g. listed, defined, implemented) and only contains entries for stages the item has actually reached; a stage never (yet) reached is simply absent from the map rather than mapped to null.

  • Constructor Details

  • Method Details

    • hasReached

      public boolean hasReached(String stage)
      Whether this item has reached stage.
      Parameters:
      stage - the stage name to check
      Returns:
      true if stageReachedAt contains stage
    • latestStage

      public Optional<String> latestStage(List<String> canonicalStages)
      The furthest stage this item has reached, per canonicalStages' own order.

      Not simply "the highest-index key present in stageReachedAt()", since some TrackerSources stamp only the single stage matching an item's current status rather than backfilling every earlier stage it must logically have passed through - the Gherkin scenario source, for one, never gains a defined entry for a scenario first observed already implemented. This walks canonicalStages from the end instead, so it always reports the furthest reached stage regardless of which earlier ones were skipped.

      Parameters:
      canonicalStages - the tracker's canonical stage names, in order
      Returns:
      the furthest reached stage, or empty if none of canonicalStages has been reached
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • group

      public String group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component
    • stageReachedAt

      public Map<String,Instant> stageReachedAt()
      Returns the value of the stageReachedAt record component.
      Returns:
      the value of the stageReachedAt record component
    • lastSeenAt

      public Instant lastSeenAt()
      Returns the value of the lastSeenAt record component.
      Returns:
      the value of the lastSeenAt record component
    • removedAt

      public Instant removedAt()
      Returns the value of the removedAt record component.
      Returns:
      the value of the removedAt record component