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 description
036         *            The {@link IBinding#getDescription() description}of the binding.
037         * @param path
038         *            The path used to get (or update) a value for the path. This may be an OGNL
039         *            expression, a message key, a literal value, or otherwise defined by the type of
040         *            binding. It is the value of the binding reference with the prefix (used to
041         *            identify the factory) stripped off.
042         * @param location
043         *            The location of the binding, used to report any errors related to the binding, or
044         *            to the component parameter the binding is bound to.
045         */
046        public IBinding createBinding(IComponent root, String bindingDescription, String path,
047                Location location);
048    }