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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValidationResultThe shared object which can be used to represent "OK" result, when there are no errors or warnings. -
Constructor Summary
ConstructorsConstructorDescriptionValidationResult(ValidationResult.Severity severity, String message, ValidationResult[] details) Creates an instance of aValidationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondetails()Returns the value of thedetailsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.merge(ValidationResult otherResult) Merges the result with a given one.message()Returns the value of themessagerecord component.severity()Returns the value of theseverityrecord 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 aValidationResultrecord class.- Parameters:
severity- the value for theseverityrecord componentmessage- the value for themessagerecord componentdetails- the value for thedetailsrecord 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 theseverityrecord component.- Returns:
- the value of the
severityrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
details
Returns the value of thedetailsrecord component.- Returns:
- the value of the
detailsrecord component
-