/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.validate;

import io.spine.validate.option.DistinctConstraint;
import io.spine.validate.option.GoesConstraint;
import io.spine.validate.option.PatternConstraint;
import io.spine.validate.option.RangedConstraint;
import io.spine.validate.option.RequiredConstraint;
import io.spine.validate.option.RequiredFieldConstraint;
import io.spine.validate.option.ValidateConstraint;

/**
 * Translates validation constraints into an output form.
 *
 * <p>The format of the output is implementation-dependant. For example, given message value,
 * a translator may perform validation and output any found {@linkplain ConstraintViolation
 * violations}. Another example would be printing validation code in a target language (e.g. Java).
 *
 * <p>A instance of {@code ConstraintTranslator} should only be used for a single type of messages.
 * A translator need not be thread-safe. An instance of translator is, most likely, a mutable
 * object. If any resources must be closed when finishing the translation job, {@link #translate()}
 * is the right place to do so.
 */
public interface ConstraintTranslator<T> {

    void visitRange(RangedConstraint<?> constraint);

    void visitRequired(RequiredConstraint constraint);

    void visitPattern(PatternConstraint constraint);

    void visitDistinct(DistinctConstraint constraint);

    void visitGoesWith(GoesConstraint constraint);

    void visitValidate(ValidateConstraint constraint);

    void visitRequiredField(RequiredFieldConstraint constraint);

    void visitCustom(CustomConstraint constraint);

    /**
     * Finalizes the translation for a message type.
     */
    T translate();
}

@@ -2133,397 +2133,1603 @@
     
-void visitRange(RangedConstraint%3C?%3E constraint);%0A%0A    void visitRequired(RequiredConstraint constraint);%0A%0A    void visitPattern(PatternConstraint constraint);%0A%0A    void visitDistinct(DistinctConstraint constraint);%0A%0A    void visitGoesWith(GoesConstraint constraint);%0A%0A    void visitValidate(ValidateConstraint constraint);%0A%0A    void visitRequiredField(RequiredFieldConstraint constraint);%0A
+/**%0A     * Translates the given %7B@link RangedConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a number field%0A     */%0A    void visitRange(RangedConstraint%3C?%3E constraint);%0A%0A    /**%0A     * Translates the given %7B@link RequiredConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a field%0A     */%0A    void visitRequired(RequiredConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link PatternConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a string field%0A     */%0A    void visitPattern(PatternConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link DistinctConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a collection field%0A     */%0A    void visitDistinct(DistinctConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link GoesConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a field%0A     */%0A    void visitGoesWith(GoesConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link ValidateConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a message field%0A     */%0A    void visitValidate(ValidateConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link RequiredFieldConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the constraint of a field combination%0A     */%0A    void visitRequiredField(RequiredFieldConstraint constraint);%0A%0A    /**%0A     * Translates the given %7B@link CustomConstraint%7D.%0A     *%0A     * @param constraint%0A     *         the self-validating constraint%0A     */
 %0A   

Add doc for methods of `ConstraintTranslator`