Record Class ValidationIssue

java.lang.Object
java.lang.Record
dev.jcputney.elearning.parser.validation.ValidationIssue

public record ValidationIssue(ValidationIssue.Severity severity, String code, String message, String location, String suggestedFix) extends Record
Represents a single validation issue found during module parsing. Immutable record containing severity, error code, message, location, and optional suggestion.
  • Constructor Details

    • ValidationIssue

      public ValidationIssue(ValidationIssue.Severity severity, String code, String message, String location, String suggestedFix)
      Creates an instance of a ValidationIssue record class.
      Parameters:
      severity - the value for the severity record component
      code - the value for the code record component
      message - the value for the message record component
      location - the value for the location record component
      suggestedFix - the value for the suggestedFix record component
  • Method Details

    • error

      public static ValidationIssue error(String code, String message, String location)
      Creates an error-level validation issue without a suggested fix.
      Parameters:
      code - Error code (e.g., "SCORM12_MISSING_RESOURCE_REF")
      message - Human-readable error message
      location - Location context (e.g., XPath or file location)
      Returns:
      ValidationIssue with ERROR severity
    • error

      public static ValidationIssue error(String code, String message, String location, String suggestedFix)
      Creates an error-level validation issue with a suggested fix.
      Parameters:
      code - Error code (e.g., "SCORM12_MISSING_RESOURCE_REF")
      message - Human-readable error message
      location - Location context (e.g., XPath or file location)
      suggestedFix - Suggested fix for the issue
      Returns:
      ValidationIssue with ERROR severity
    • warning

      public static ValidationIssue warning(String code, String message, String location)
      Creates a warning-level validation issue without a suggested fix.
      Parameters:
      code - Warning code
      message - Human-readable warning message
      location - Location context
      Returns:
      ValidationIssue with WARNING severity
    • warning

      public static ValidationIssue warning(String code, String message, String location, String suggestedFix)
      Creates a warning-level validation issue with a suggested fix.
      Parameters:
      code - Warning code
      message - Human-readable warning message
      location - Location context
      suggestedFix - Suggested fix for the issue
      Returns:
      ValidationIssue with WARNING severity
    • 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.
    • severity

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

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • location

      public String location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • suggestedFix

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