Skip to the content.
package com.bookshop.behavioral.chainofresponsibility;

/** Outcome of running an order through the validation chain. */
public record ValidationResult(boolean valid, String rejectedBy, String reason) {

    public static ValidationResult ok() {
        return new ValidationResult(true, null, null);
    }

    public static ValidationResult rejected(String checkName, String reason) {
        return new ValidationResult(false, checkName, reason);
    }
}

Raw file