Record Class DefaultValidationResult

java.lang.Object
java.lang.Record
ai.pipestream.common.validation.DefaultValidationResult
Record Components:
valid - whether the validation passed
errors - list of error messages if validation failed
warnings - list of warning messages
All Implemented Interfaces:
ValidationResult

public record DefaultValidationResult(boolean valid, List<String> errors, List<String> warnings) extends Record implements ValidationResult
Result of pipeline configuration validation. Contains validation status, errors, and warnings.
  • Constructor Details

    • DefaultValidationResult

      public DefaultValidationResult(boolean valid, List<String> errors, List<String> warnings)
      Ensures immutability of lists
  • Method Details

    • success

      public static ValidationResult success()
      Creates a valid result with no errors or warnings.
      Returns:
      a valid ValidationResult with no errors or warnings
    • successWithWarnings

      public static ValidationResult successWithWarnings(List<String> warnings)
      Creates a valid result with warnings.
      Parameters:
      warnings - list of warning messages
      Returns:
      a valid ValidationResult with the specified warnings
    • failure

      public static ValidationResult failure(List<String> errors)
      Creates an invalid result with the given errors.
      Parameters:
      errors - list of error messages
      Returns:
      an invalid ValidationResult with the specified errors
    • failure

      public static ValidationResult failure(String error)
      Creates an invalid result with a single error.
      Parameters:
      error - the error message
      Returns:
      an invalid ValidationResult with the specified error
    • failure

      public static ValidationResult failure(List<String> errors, List<String> warnings)
      Creates an invalid result with errors and warnings.
      Parameters:
      errors - list of error messages
      warnings - list of warning messages
      Returns:
      an invalid ValidationResult with the specified errors and warnings
    • combine

      public ValidationResult combine(ValidationResult other)
      Combines this result with another, taking the most restrictive validity. Accumulates all errors and warnings from both results.
      Specified by:
      combine in interface ValidationResult
      Parameters:
      other - the other validation result to combine with
      Returns:
      a new combined validation result
    • hasIssues

      public boolean hasIssues()
      Returns true if there are any issues (errors or warnings).
      Specified by:
      hasIssues in interface ValidationResult
      Returns:
      true if there are any issues
    • hasErrors

      public boolean hasErrors()
      Returns true if there are any errors.
      Specified by:
      hasErrors in interface ValidationResult
      Returns:
      true if there are any errors
    • hasWarnings

      public boolean hasWarnings()
      Returns true if there are any warnings.
      Specified by:
      hasWarnings in interface ValidationResult
      Returns:
      true if there are any warnings
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • valid

      public boolean valid()
      Returns the value of the valid record component.
      Specified by:
      valid in interface ValidationResult
      Returns:
      the value of the valid record component
    • errors

      public List<String> errors()
      Returns the value of the errors record component.
      Specified by:
      errors in interface ValidationResult
      Returns:
      the value of the errors record component
    • warnings

      public List<String> warnings()
      Returns the value of the warnings record component.
      Specified by:
      warnings in interface ValidationResult
      Returns:
      the value of the warnings record component