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

org.seedstack.business.spi.SpecificationTranslator Maven / Gradle / Ivy

/*
 * Copyright © 2013-2024, The SeedStack authors 
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.business.spi;

import org.seedstack.business.specification.Specification;

/**
 * Translates a {@link Specification} into a target object by invoking the relevant {@link
 * SpecificationConverter}s.
 *
 * @param  the type of the translation context object.
 * @param  the type of the translated target object.
 */
public interface SpecificationTranslator {

    /**
     * Translates the specified composite specification into a target object.
     *
     * @param specification the {@link Specification} to translate.
     * @param context       the translation context.
     * @param            the type of the specification to translate.
     * @return the target object representing the fully translated specification.
     */
    > T translate(S specification, C context);

    /**
     * Returns the class of translation context.
     *
     * @return the class of the translation context object.
     */
    Class getContextClass();

    /**
     * Returns the class of target object.
     *
     * @return the class of the target object.
     */
    Class getTargetClass();

}