    001    // Copyright 2010 The Apache Software Foundation
    002    //
    003    // Licensed under the Apache License, Version 2.0 (the "License");
    004    // you may not use this file except in compliance with the License.
    005    // You may obtain a copy of the License at
    006    //
    007    // http://www.apache.org/licenses/LICENSE-2.0
    008    //
    009    // Unless required by applicable law or agreed to in writing, software
    010    // distributed under the License is distributed on an "AS IS" BASIS,
    011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012    // See the License for the specific language governing permissions and
    013    // limitations under the License.
    014
    015    package org.apache.tapestry5.services;
    016
    017    import java.util.Map;
    018
    019    import org.apache.tapestry5.Translator;
    020    import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
    021
    022    /**
    023     * This service is used by {@link TranslatorSource} to specify {@link Translator} <em>alternates</em>: translators that
    024     * are used when specified explicitly by name. These translators may overlap the standard translators
    025     * by type (thus requiring a separate configuration).
    026     * <p>
    027     * Translators contributed to this configuration must have names that do not overlap the standard translators. Further,
    028     * the contribution key must match the {@linkplain Translator#getName() translator name}.
    029     *
    030     * @since 5.2.0
    031     */
    032    @UsesMappedConfiguration(Translator.class)
    033    public interface TranslatorAlternatesSource
    034    {
    035        /**
    036         * Get the mapping from name to Translator, based on the contributions to the service. It will be verified
    037         * that the keys of the map corresponding to the names of the Translator values.
    038         */
    039        Map<String, Translator> getTranslatorAlternates();
    040    }