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

io.toolisticon.aptk.tools.wrapper.ElementWrapperValidatorInterface Maven / Gradle / Ivy

package io.toolisticon.aptk.tools.wrapper;

import io.toolisticon.aptk.tools.corematcher.ValidationMessage;

import java.util.function.Predicate;

/**
 * Wrapper based Element validator
 */
public class ElementWrapperValidatorInterface {

    /**
     * Initial builder interface.
     * @param  The wrapper type
     */
    public interface FirstValidation> {

        /**
         * Set the compiuler message level to NOTE.
         * @return the next builder instance.
         */
        FirstValidationWithScope asInfo();

        /**
         * Set the compiuler message level to WARNING.
         * @return the next builder instance.
         */
        FirstValidationWithScope asWarning();

        /**
         * Set the compiuler message level to MANDATORY_WARNING.
         * @return the next builder instance.
         */
        FirstValidationWithScope asMandatoryWarning();

        /**
         * Set the compiuler message level to ERROR.
         * @return the next builder instance.
         */
        FirstValidationWithScope asError();

        FirstValidationWithScopeAndCustomMessage withCustomMessage(ValidationMessage message, Object... vars);

        FirstValidationWithScopeAndCustomMessage withCustomMessage(String message, Object... vars);

        /**
         * Adds a validation check.
         * @param predicate the Predicate to check for
         * @return the next fluent api instance
         */
        FollowUpValidationOrEndValidation check(Predicate predicate);

    }

    public interface FirstValidationWithScope> {

        FirstValidationWithScopeAndCustomMessage withCustomMessage(ValidationMessage message, Object... vars);

        FirstValidationWithScopeAndCustomMessage withCustomMessage(String message, Object... vars);


        FollowUpValidationOrEndValidation check(Predicate predicate);

    }

    public interface FirstValidationWithScopeAndCustomMessage> {

        FollowUpValidationOrEndValidation check(Predicate predicate);

    }

    public interface FollowUpValidationOrEndValidation> {

        FollowUpValidationOrEndValidation and(Predicate predicate);

        /**
         * Validates all checks and returns a result.
         * Only checks with error level will cause the validation to fail.
         *
         * @return the validation result
         */
        boolean validate();

        /**
         * Validates all checks, issue compiler messages and returns the result.
         *
         * @return the validation result
         */
        boolean validateAndIssueMessages();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy