Record Class GitPatch.SimpleGitPatch

java.lang.Object
java.lang.Record
org.variantsync.diffdetective.diff.git.GitPatch.SimpleGitPatch
Record Components:
getDiff - The diff in text form.
getChangeType - The change type of this patch (e.g., file insertion or modification).
oldFileName - The name of the patched file before the edit.
newFileName - The name of the patched file after the edit.
getCommitHash - The hash of the commit introducing the change.
getParentCommitHash - The hash of the parent commit regarding which the diff was created.
All Implemented Interfaces:
GitPatch, TextBasedDiff, VariationDiffSource
Enclosing interface:
GitPatch

public static record GitPatch.SimpleGitPatch(String getDiff, org.eclipse.jgit.diff.DiffEntry.ChangeType getChangeType, String oldFileName, String newFileName, String getCommitHash, String getParentCommitHash) extends Record implements GitPatch
Minimal default implementation of GitPatch
  • Field Details

    • getDiff

      private final String getDiff
      The field for the getDiff record component.
    • getChangeType

      private final org.eclipse.jgit.diff.DiffEntry.ChangeType getChangeType
      The field for the getChangeType record component.
    • oldFileName

      private final String oldFileName
      The field for the oldFileName record component.
    • newFileName

      private final String newFileName
      The field for the newFileName record component.
    • getCommitHash

      private final String getCommitHash
      The field for the getCommitHash record component.
    • getParentCommitHash

      private final String getParentCommitHash
      The field for the getParentCommitHash record component.
  • Constructor Details

    • SimpleGitPatch

      public SimpleGitPatch(String getDiff, org.eclipse.jgit.diff.DiffEntry.ChangeType getChangeType, String oldFileName, String newFileName, String getCommitHash, String getParentCommitHash)
      Creates an instance of a SimpleGitPatch record class.
      Parameters:
      getDiff - the value for the getDiff record component
      getChangeType - the value for the getChangeType record component
      oldFileName - the value for the oldFileName record component
      newFileName - the value for the newFileName record component
      getCommitHash - the value for the getCommitHash record component
      getParentCommitHash - the value for the getParentCommitHash record component
  • Method Details

    • getFileName

      public String getFileName(Time time)
      Description copied from interface: GitPatch
      Returns the name of the patched file at the given time.
      Specified by:
      getFileName in interface GitPatch
    • shallowClone

      public GitPatch shallowClone()
      Description copied from interface: GitPatch
      Creates a shallow clone. A shallow clone should return the very same values for the methods of this interface. Other behaviour is unspecified.
      Specified by:
      shallowClone in interface GitPatch
      Returns:
      A clone that acts equal with respect to this interface.
    • toString

      public 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.
    • getDiff

      public String getDiff()
      Returns the value of the getDiff record component.
      Specified by:
      getDiff in interface TextBasedDiff
      Returns:
      the value of the getDiff record component
    • getChangeType

      public org.eclipse.jgit.diff.DiffEntry.ChangeType getChangeType()
      Returns the value of the getChangeType record component.
      Specified by:
      getChangeType in interface GitPatch
      Returns:
      the value of the getChangeType record component
    • oldFileName

      public String oldFileName()
      Returns the value of the oldFileName record component.
      Returns:
      the value of the oldFileName record component
    • newFileName

      public String newFileName()
      Returns the value of the newFileName record component.
      Returns:
      the value of the newFileName record component
    • getCommitHash

      public String getCommitHash()
      Returns the value of the getCommitHash record component.
      Specified by:
      getCommitHash in interface GitPatch
      Returns:
      the value of the getCommitHash record component
    • getParentCommitHash

      public String getParentCommitHash()
      Returns the value of the getParentCommitHash record component.
      Specified by:
      getParentCommitHash in interface GitPatch
      Returns:
      the value of the getParentCommitHash record component