Record Class Reason
java.lang.Object
java.lang.Record
be.sddevelopment.validation.core.Reason
Reason class.
Represents the evaluation of a singleConstraint
, and will be included in a Rationale
.
Each reason will tell the user whether a particular rule passed or failed, and will include a description (aka "rationale") to explain why a certain result was achieved.
This class is immutable, and provides static factory methods to simplify usage, and increase readability..
- Since:
- 1.0.0-SNAPSHOT
- Version:
- 1.0.0-SNAPSHOT
-
Constructor Summary
ConstructorDescriptionReason
(String rationale, Evaluation result) Creates an instance of aReason
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static Reason
final int
hashCode()
Returns a hash code value for this object.boolean
boolean
static Reason
Returns the value of therationale
record component.result()
Returns the value of theresult
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Reason
Creates an instance of aReason
record class.- Parameters:
rationale
- the value for therationale
record componentresult
- the value for theresult
record component
-
-
Method Details
-
passed
-
failed
-
isPassing
public boolean isPassing() -
isFailing
public boolean isFailing() -
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
rationale
Returns the value of therationale
record component.- Returns:
- the value of the
rationale
record component
-
result
Returns the value of theresult
record component.- Returns:
- the value of the
result
record component
-