Record Class ValidationResult
java.lang.Object
java.lang.Record
com.loomcache.server.config.ValidationResult
- Record Components:
valid- whether the value is validerrorMessage- optional error message (null if valid)
-
Constructor Summary
ConstructorsConstructorDescriptionValidationResult(boolean valid, @Nullable String errorMessage) Creates an instance of aValidationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.@Nullable StringReturns the value of theerrorMessagerecord component.static ValidationResultCreate a failure result.final inthashCode()Returns a hash code value for this object.static ValidationResultsuccess()Create a success result.final StringtoString()Returns a string representation of this record class.booleanvalid()Returns the value of thevalidrecord component.
-
Constructor Details
-
ValidationResult
Creates an instance of aValidationResultrecord class.- Parameters:
valid- the value for thevalidrecord componenterrorMessage- the value for theerrorMessagerecord component
-
-
Method Details
-
success
-
failure
Create a failure result.- Parameters:
message- the error message- Returns:
- an invalid ValidationResult
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
valid
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-