Record Class Suppression

java.lang.Object
java.lang.Record
dev.archunitjava.baseline.Suppression
All Implemented Interfaces:
Comparable<Suppression>

public record Suppression(String id, String rationale, Optional<String> ruleId, Optional<String> subjectId, Optional<String> evidenceLocation, Optional<LocalDate> expiresOn) extends Record implements Comparable<Suppression>
Reviewed, rationalized suppression with composable exact scope and optional expiry.
  • Constructor Details

    • Suppression

      public Suppression(String id, String rationale, Optional<String> ruleId, Optional<String> subjectId, Optional<String> evidenceLocation, Optional<LocalDate> expiresOn)
      Creates an instance of a Suppression record class.
      Parameters:
      id - the value for the id record component
      rationale - the value for the rationale record component
      ruleId - the value for the ruleId record component
      subjectId - the value for the subjectId record component
      evidenceLocation - the value for the evidenceLocation record component
      expiresOn - the value for the expiresOn record component
  • Method Details

    • forRule

      public static Suppression forRule(String id, String rationale, String ruleId, Optional<LocalDate> expiresOn)
    • matches

      public boolean matches(BaselineFinding finding)
    • expiredOn

      public boolean expiredOn(LocalDate date)
      Expiry dates are inclusive: the suppression is valid through the named date.
    • compareTo

      public int compareTo(Suppression other)
      Specified by:
      compareTo in interface Comparable<Suppression>
    • 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
    • rationale

      public String rationale()
      Returns the value of the rationale record component.
      Returns:
      the value of the rationale record component
    • ruleId

      public Optional<String> ruleId()
      Returns the value of the ruleId record component.
      Returns:
      the value of the ruleId record component
    • subjectId

      public Optional<String> subjectId()
      Returns the value of the subjectId record component.
      Returns:
      the value of the subjectId record component
    • evidenceLocation

      public Optional<String> evidenceLocation()
      Returns the value of the evidenceLocation record component.
      Returns:
      the value of the evidenceLocation record component
    • expiresOn

      public Optional<LocalDate> expiresOn()
      Returns the value of the expiresOn record component.
      Returns:
      the value of the expiresOn record component