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:
ai.pipestream.api.validation.ValidationResult

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

    Constructors
    Constructor
    Description
    DefaultValidationResult(boolean valid, List<String> errors, List<String> warnings)
    Ensures immutability of lists
  • Method Summary

    Modifier and Type
    Method
    Description
    ai.pipestream.api.validation.ValidationResult
    combine(ai.pipestream.api.validation.ValidationResult other)
    Combines this result with another, taking the most restrictive validity.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the errors record component.
    static ai.pipestream.api.validation.ValidationResult
    failure(String error)
    Creates an invalid result with a single error.
    static ai.pipestream.api.validation.ValidationResult
    failure(List<String> errors)
    Creates an invalid result with the given errors.
    static ai.pipestream.api.validation.ValidationResult
    failure(List<String> errors, List<String> warnings)
    Creates an invalid result with errors and warnings.
    boolean
    Returns true if there are any errors.
    final int
    Returns a hash code value for this object.
    boolean
    Returns true if there are any issues (errors or warnings).
    boolean
    Returns true if there are any warnings.
    static ai.pipestream.api.validation.ValidationResult
    Creates a valid result with no errors or warnings.
    static ai.pipestream.api.validation.ValidationResult
    Creates a valid result with warnings.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the valid record component.
    Returns the value of the warnings record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DefaultValidationResult

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

    • success

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

      public static ai.pipestream.api.validation.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 ai.pipestream.api.validation.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 ai.pipestream.api.validation.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 ai.pipestream.api.validation.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 ai.pipestream.api.validation.ValidationResult combine(ai.pipestream.api.validation.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 ai.pipestream.api.validation.ValidationResult
    • hasIssues

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

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

      public boolean hasWarnings()
      Returns true if there are any warnings.
      Specified by:
      hasWarnings in interface ai.pipestream.api.validation.ValidationResult
    • 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 ai.pipestream.api.validation.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 ai.pipestream.api.validation.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 ai.pipestream.api.validation.ValidationResult
      Returns:
      the value of the warnings record component