Package com.esprow.oapi
Record Class ValidationResult
java.lang.Object
java.lang.Record
com.esprow.oapi.ValidationResult
public record ValidationResult(ValidationResult.Severity severity, String message, ValidationResult[] details)
extends Record
Represents a validation result as a message, severity level, and optional nested results.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ValidationResult
The shared object which can be used to represent "OK" result, when there are no errors or warnings. -
Constructor Summary
ConstructorDescriptionValidationResult
(ValidationResult.Severity severity, String message, ValidationResult[] details) Creates an instance of aValidationResult
record class. -
Method Summary
Modifier and TypeMethodDescriptiondetails()
Returns the value of thedetails
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.merge
(ValidationResult otherResult) Merges the result with a given one.message()
Returns the value of themessage
record component.severity()
Returns the value of theseverity
record component.toString()
Returns a string representation of this record class.
-
Field Details
-
OK_RESULT
The shared object which can be used to represent "OK" result, when there are no errors or warnings.
-
-
Constructor Details
-
ValidationResult
public ValidationResult(ValidationResult.Severity severity, String message, ValidationResult[] details) Creates an instance of aValidationResult
record class.- Parameters:
severity
- the value for theseverity
record componentmessage
- the value for themessage
record componentdetails
- the value for thedetails
record component
-
-
Method Details
-
merge
Merges the result with a given one.- Parameters:
otherResult
- the other validation result- Returns:
- new merged result, having a message and a severity level from the result having highest one. Detail results are appended.
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
severity
Returns the value of theseverity
record component.- Returns:
- the value of the
severity
record component
-
message
Returns the value of themessage
record component.- Returns:
- the value of the
message
record component
-
details
Returns the value of thedetails
record component.- Returns:
- the value of the
details
record component
-