001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.services;
014
015import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
016
017/**
018 * Service that allows replacing one component, page or mixin class by another without changing the sources.
019 * This service shouldn't be used directly: it's not an internal service just because it receives
020 * contributions.
021 * 
022 * Contributions to it are mapped: the key is the component, page or mixin class to be
023 * replaced, the value is the replacement.
024 *
025 * @since 5.4
026 * @see org.apache.tapestry5.services.ComponentClassResolver
027 */
028@UsesMappedConfiguration(key = Class.class, value = Class.class)
029public interface ComponentOverride
030{
031
032    /**
033     * Returns true if the service configuration is non-empty.
034     * 
035     */
036   boolean hasReplacements();
037    
038    /**
039     * Returns the replacement for a class given its name.
040     * @param className the fully qualified class name.
041     * @return a {@link Class} or null.
042     */
043    Class getReplacement(String className);
044    
045}