Package be.sddevelopment.validation
Record Class Reason
java.lang.Object
java.lang.Record
be.sddevelopment.validation.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
ConstructorsConstructorDescriptionReason(String rationale, Evaluation result) Creates an instance of aReasonrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static Reasonfinal inthashCode()Returns a hash code value for this object.booleanbooleanstatic ReasonReturns the value of therationalerecord component.result()Returns the value of theresultrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Reason
Creates an instance of aReasonrecord class.- Parameters:
rationale- the value for therationalerecord componentresult- the value for theresultrecord component
-
-
Method Details
-
passed
-
failed
-
isPassing
public boolean isPassing() -
isFailing
public boolean isFailing() -
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). -
rationale
Returns the value of therationalerecord component.- Returns:
- the value of the
rationalerecord component
-
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-