001// Copyright 2004, 2005 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
015package org.apache.tapestry.services;
016
017import org.apache.tapestry.spec.IComponentSpecification;
018
019/**
020 * <code>tapestry.enhance.ComponentConstructorFactory</code> service that acts as a wrapper around
021 * {@link org.apache.tapestry.enhance.EnhancementOperation}, used to take a base component class
022 * and provide an enhanced subclass of it.
023 * 
024 * @author Howard M. Lewis Ship
025 * @since 4.0
026 */
027public interface ComponentConstructorFactory
028{
029    /**
030     * Passed a component specification and the base component class name, provides back an object
031     * used to instantiate instances of the component. {@link ComponentConstructor}s are internally
032     * cached, repeated calls with the same specification object will yield the same result.
033     * 
034     * @param specification
035     *            the page or component specification which directs the enhancement operation
036     * @param className
037     *            the name of the base component class (in some cases,
038     *            {@link IComponentSpecification#getComponentClassName() is null andother code
039     *            provides the default)
040     * @returns a constructor used to create instances of the enhanced component class
041     */
042
043    public ComponentConstructor getComponentConstructor(IComponentSpecification specification,
044            String className);
045}