All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.solidcoding.validation.api.ContinuingValidator Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package org.solidcoding.validation.api;

import java.util.function.Function;
import java.util.function.Supplier;

public interface ContinuingValidator extends ThrowingValidator {

    /**
     * @return the failure message;
     */
    String getMessage();

    ContinuingValidator and(Rule rule);

    /**
     * @return boolean true if all rules pass. False if at least one rule fails.
     */
    boolean validate();

    /**
     * Same as validate(); but returns a custom object in the form of a supplier.
     *
     * @param supplier the supplier which encapsulated the return type.
     * @param       the type you wish to return.
     * @return R in the form of a supplier.
     */
     ReturningValidator andThen(Supplier supplier);

    /**
     * Same as validate(); but returns a custom object in the form of a supplier.
     *
     * @param runnable the runnable process which should be started after successful validation.
     * @return R in the form of a supplier.
     */
    VoidValidator andThen(Runnable runnable);

    /**
     * @param other the backup/default return type if the validation fails.
     * @return T the return type.
     */
    T orElseReturn(T other);

    /**
     * @param other the backup/default return type if the validation fails with the optional message that is contained in the Validator.
     * @return T the return type.
     */
    T orElseReturn(Function other);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy