Package ai.pipestream.common.validation
Record Class DefaultValidationResult
java.lang.Object
java.lang.Record
ai.pipestream.common.validation.DefaultValidationResult
- Record Components:
valid- whether the validation passederrors- list of error messages if validation failedwarnings- 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 Summary
ConstructorsConstructorDescriptionDefaultValidationResult(boolean valid, List<String> errors, List<String> warnings) Ensures immutability of lists -
Method Summary
Modifier and TypeMethodDescriptioncombine(ValidationResult other) Combines this result with another, taking the most restrictive validity.final booleanIndicates whether some other object is "equal to" this one.errors()Returns the value of theerrorsrecord component.static ValidationResultCreates an invalid result with a single error.static ValidationResultCreates an invalid result with the given errors.static ValidationResultCreates an invalid result with errors and warnings.booleanReturns true if there are any errors.final inthashCode()Returns a hash code value for this object.booleanReturns true if there are any issues (errors or warnings).booleanReturns true if there are any warnings.static ValidationResultsuccess()Creates a valid result with no errors or warnings.static ValidationResultsuccessWithWarnings(List<String> warnings) Creates a valid result with warnings.final StringtoString()Returns a string representation of this record class.booleanvalid()Returns the value of thevalidrecord component.warnings()Returns the value of thewarningsrecord component.
-
Constructor Details
-
DefaultValidationResult
Ensures immutability of lists
-
-
Method Details
-
success
Creates a valid result with no errors or warnings.- Returns:
- a valid ValidationResult with no errors or warnings
-
successWithWarnings
Creates a valid result with warnings.- Parameters:
warnings- list of warning messages- Returns:
- a valid ValidationResult with the specified warnings
-
failure
Creates an invalid result with the given errors.- Parameters:
errors- list of error messages- Returns:
- an invalid ValidationResult with the specified errors
-
failure
Creates an invalid result with a single error.- Parameters:
error- the error message- Returns:
- an invalid ValidationResult with the specified error
-
failure
Creates an invalid result with errors and warnings.- Parameters:
errors- list of error messageswarnings- list of warning messages- Returns:
- an invalid ValidationResult with the specified errors and warnings
-
combine
Combines this result with another, taking the most restrictive validity. Accumulates all errors and warnings from both results.- Specified by:
combinein interfaceValidationResult- 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:
hasIssuesin interfaceValidationResult- Returns:
- true if there are any issues
-
hasErrors
public boolean hasErrors()Returns true if there are any errors.- Specified by:
hasErrorsin interfaceValidationResult- Returns:
- true if there are any errors
-
hasWarnings
public boolean hasWarnings()Returns true if there are any warnings.- Specified by:
hasWarningsin interfaceValidationResult- Returns:
- true if there are any warnings
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
valid
public boolean valid()Returns the value of thevalidrecord component.- Specified by:
validin interfaceValidationResult- Returns:
- the value of the
validrecord component
-
errors
Returns the value of theerrorsrecord component.- Specified by:
errorsin interfaceValidationResult- Returns:
- the value of the
errorsrecord component
-
warnings
Returns the value of thewarningsrecord component.- Specified by:
warningsin interfaceValidationResult- Returns:
- the value of the
warningsrecord component
-