01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.services;
16:
17: import org.apache.tapestry.Binding;
18: import org.apache.tapestry.ComponentResources;
19: import org.apache.tapestry.ioc.Location;
20:
21: /**
22: * Used to acquire bindings for component parameters.
23: */
24: public interface BindingSource {
25: /**
26: * Examines the expression and strips off the leading prefix. The prefix is used to choose the
27: * appropriate {@link BindingFactory}, which recieves the description, the expression (after
28: * the prefix), and the location. If the prefix doesn't exist, or if there's no prefix, then the
29: * factory for the default prefix (often "literal") is used (and passed the full prefix).
30: * <p>
31: * The binding represents a connection between the container and the component (the component is
32: * usually the child of the container, though in a few cases, it is the component itself). In
33: * most cases, the expression is evaluated in terms of the resources of the <em>container</em>
34: * and the component is ignored.
35: *
36: * @param description
37: * description of the binding, such as "parameter foo"
38: * @param container
39: * typically, the parent of the component
40: * @param component
41: * the component whose parameter is to be bound
42: * @param defaultPrefix
43: * the default prefix used when the expression itself does not have a prefix
44: * @param expression
45: * the binding
46: * @param location
47: * location assigned to the binding (or null if not known)
48: * @return a binding
49: */
50: Binding newBinding(String description,
51: ComponentResources container, ComponentResources component,
52: String defaultPrefix, String expression, Location location);
53:
54: /**
55: * A simpler version of
56: * {@link #newBinding(String, ComponentResources, ComponentResources, String, String, Location)}
57: * that defaults the values for several parameters. This is used in most cases. The default
58: * binding prefix will be "prop". Most often, this is used to create a new default binding.
59: *
60: * @param description
61: * description of the binding, such as "parameter foo"
62: * @param container
63: * typically, the parent of the component. This value will be used as the container
64: * <em>and</em> the component, so whatever type of expression is evaluated, will be
65: * evaulated in terms of this component
66: * @param defaultPrefix
67: * the default prefix used when the expression itself does not have a prefix
68: * @param expression
69: * the binding
70: * @return a binding
71: */
72: Binding newBinding(String description,
73: ComponentResources container, String defaultPrefix,
74: String expression);
75: }
|