    001    // Copyright 2006 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 org.apache.tapestry5.Binding;
    018    import org.apache.tapestry5.ComponentResources;
    019    import org.apache.tapestry5.ioc.Location;
    020
    021    /**
    022     * Creates a binding of a particular type.  This is usually invoked from the {@link
    023     * org.apache.tapestry5.services.BindingSource} service.
    024     */
    025    public interface BindingFactory
    026    {
    027        /**
    028         * Creates a new binding instance.
    029         * <p/>
    030         * The binding represents a connection between the container and the component (the component is usually the child
    031         * of the component, though in a few cases, it is the component itself). In most cases, the expression is evaluated
    032         * in terms of the resources of the <em>container</em> and the component is ignored.
    033         *
    034         * @param description of the binding, such as, "parameter foo"
    035         * @param container   the component, as represented by its resources, for which a binding is to be created.
    036         * @param component   the component whose parameter is to be bound by the resulting binding (rarely used)
    037         * @param expression
    038         * @param location    from which the binding was generate, or null if not known
    039         * @return the new binding instance
    040         */
    041        Binding newBinding(String description, ComponentResources container, ComponentResources component,
    042                           String expression, Location location);
    043    }