Record Class DiffLine

java.lang.Object
java.lang.Record
io.github.jbastgen.stemma.app.model.DiffLine
Record Components:
action - for a hunk header of the working tree: "stage" or "unstage", the action the view offers for that hunk; null otherwise

public record DiffLine(char type, Integer oldNo, Integer newNo, String text, String action) extends Record
One line of a unified diff. type is '@' (hunk header), '+', '-', ' ', or 'S' for the title of a section ("Unstaged changes").
  • Constructor Details

    • DiffLine

      public DiffLine(char type, Integer oldNo, Integer newNo, String text)
      A line without an action.
    • DiffLine

      public DiffLine(char type, Integer oldNo, Integer newNo, String text, String action)
      Creates an instance of a DiffLine record class.
      Parameters:
      type - the value for the type record component
      oldNo - the value for the oldNo record component
      newNo - the value for the newNo record component
      text - the value for the text record component
      action - the value for the action record component
  • Method Details

    • withAction

      public DiffLine withAction(String newAction)
      The same line with the action of its hunk or line selection, e.g. "stage" or "unstage".
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • type

      public char type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • oldNo

      public Integer oldNo()
      Returns the value of the oldNo record component.
      Returns:
      the value of the oldNo record component
    • newNo

      public Integer newNo()
      Returns the value of the newNo record component.
      Returns:
      the value of the newNo record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • action

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