Record Class UpgradeResult

java.lang.Object
java.lang.Record
org.apache.maven.cling.invoker.mvnup.goals.UpgradeResult
Record Components:
processedPoms - the set of POMs that were processed
modifiedPoms - the set of POMs that were modified
errorPoms - the set of POMs that had errors

public record UpgradeResult(Set<Path> processedPoms, Set<Path> modifiedPoms, Set<Path> errorPoms) extends Record
Result of an upgrade strategy application. Uses sets of paths to track which POMs were processed, modified, or had errors, avoiding double-counting when multiple strategies affect the same POMs.
  • Constructor Details

    • UpgradeResult

      public UpgradeResult(Set<Path> processedPoms, Set<Path> modifiedPoms, Set<Path> errorPoms)
      Creates an instance of a UpgradeResult record class.
      Parameters:
      processedPoms - the value for the processedPoms record component
      modifiedPoms - the value for the modifiedPoms record component
      errorPoms - the value for the errorPoms record component
  • Method Details

    • success

      public static UpgradeResult success(Set<Path> processedPoms, Set<Path> modifiedPoms)
      Creates a successful result with the specified processed and modified POMs.
    • failure

      public static UpgradeResult failure(Set<Path> processedPoms, Set<Path> errorPoms)
      Creates a failure result with the specified processed POMs and error POMs.
    • empty

      public static UpgradeResult empty()
      Creates an empty result (no POMs processed).
    • merge

      public UpgradeResult merge(UpgradeResult other)
      Merges this result with another result, combining the sets of POMs. This allows proper aggregation of results from multiple strategies without double-counting.
    • success

      public boolean success()
      Returns true if no errors occurred.
    • processedCount

      public int processedCount()
      Returns the number of POMs processed.
    • modifiedCount

      public int modifiedCount()
      Returns the number of POMs modified.
    • errorCount

      public int errorCount()
      Returns the number of POMs that had errors.
    • unmodifiedCount

      public int unmodifiedCount()
      Returns the number of POMs that were processed but not modified and had no errors.
    • 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.
    • processedPoms

      public Set<Path> processedPoms()
      Returns the value of the processedPoms record component.
      Returns:
      the value of the processedPoms record component
    • modifiedPoms

      public Set<Path> modifiedPoms()
      Returns the value of the modifiedPoms record component.
      Returns:
      the value of the modifiedPoms record component
    • errorPoms

      public Set<Path> errorPoms()
      Returns the value of the errorPoms record component.
      Returns:
      the value of the errorPoms record component