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    
015    package org.apache.tapestry.binding;
016    
017    import org.apache.hivemind.Location;
018    import org.apache.tapestry.IBinding;
019    import org.apache.tapestry.IComponent;
020    
021    /**
022     * Creates a new instance of {@link org.apache.tapestry.IBinding}.
023     * 
024     * @author Howard Lewis Ship
025     * @since 4.0
026     */
027    public interface BindingFactory
028    {
029        /**
030         * Creates a new binding instance.
031         * 
032         * @param root
033         *            the component that is the source of properties or messages (or etc.). When the
034         *            path is "evaluated", the root component provides a context.
035         * @param bindingDescription
036         *            The {@link IBinding#getDescription() description} of the binding.
037         * @param expression
038         *            The expression used to get (or update) a value. The interpretation of this
039         *            expression is determined by the type of {@link IBinding} created by this factory.
040         *            In some cases, it is simple the name of an object contained by the root component.
041         *            For the common "ognl:" binding prefix, it is an OGNL expression to be evaluated on
042         *            the root object.
043         * @param location
044         *            The location of the binding, used to report any errors related to the binding, or
045         *            to the component parameter the binding is bound to.
046         *
047         * @return A {@link IBinding} instance for the specific expression given. 
048         */
049        IBinding createBinding(IComponent root, String bindingDescription, String expression,
050                Location location);
051    }