Record Class RuleMetadata

java.lang.Object
java.lang.Record
dev.archunitjava.result.RuleMetadata
All Implemented Interfaces:
Comparable<RuleMetadata>

public record RuleMetadata(String semanticIdentity, String presentationIdentity, String displayName, String description, Optional<String> rationale, List<String> tags, Severity severity) extends Record implements Comparable<RuleMetadata>
Immutable rule metadata carried losslessly into every result and renderer.
  • Constructor Details

    • RuleMetadata

      public RuleMetadata(String semanticIdentity, String presentationIdentity, String displayName, String description, Optional<String> rationale, List<String> tags, Severity severity)
      Creates an instance of a RuleMetadata record class.
      Parameters:
      semanticIdentity - the value for the semanticIdentity record component
      presentationIdentity - the value for the presentationIdentity record component
      displayName - the value for the displayName record component
      description - the value for the description record component
      rationale - the value for the rationale record component
      tags - the value for the tags record component
      severity - the value for the severity record component
  • Method Details

    • of

      public static RuleMetadata of(String semanticIdentity, String description)
    • as

      public RuleMetadata as(String displayName)
      Presentation-only alias; the semantic identity remains unchanged.
    • because

      public RuleMetadata because(String rationale)
    • tagged

      public RuleMetadata tagged(String... values)
    • tagged

      public RuleMetadata tagged(Collection<String> values)
    • withSeverity

      public RuleMetadata withSeverity(Severity value)
    • humanDescription

      public String humanDescription()
      Human-ready wording; escaping remains the renderer's responsibility.
    • compareTo

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

      public String semanticIdentity()
      Returns the value of the semanticIdentity record component.
      Returns:
      the value of the semanticIdentity record component
    • presentationIdentity

      public String presentationIdentity()
      Returns the value of the presentationIdentity record component.
      Returns:
      the value of the presentationIdentity record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • description

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

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

      public List<String> tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component
    • severity

      public Severity severity()
      Returns the value of the severity record component.
      Returns:
      the value of the severity record component