Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
IBinding |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // 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; |
|
16 | ||
17 | import org.apache.hivemind.Locatable; |
|
18 | ||
19 | /** |
|
20 | * A binding is the mechanism used to provide values for parameters of specific {@link IComponent} |
|
21 | * instances. The component doesn't care where the required value comes from, it simply requires |
|
22 | * that a value be provided when needed. |
|
23 | * <p> |
|
24 | * Bindings are set inside the containing component's specification or template. Bindings may be |
|
25 | * invariant or dynamic (though that is irrelevant to the component). Components may also use a |
|
26 | * binding to write a value back through a property to some other object (typically, another |
|
27 | * component). |
|
28 | * |
|
29 | * @author Howard Lewis Ship |
|
30 | */ |
|
31 | ||
32 | public interface IBinding extends Locatable |
|
33 | { |
|
34 | /** |
|
35 | * Returns the value of this binding. This is the essential method. |
|
36 | */ |
|
37 | ||
38 | Object getObject(); |
|
39 | ||
40 | /** |
|
41 | * Returns the value for the binding after performing some basic checks. |
|
42 | * <p> |
|
43 | * Note: In release 4.0, the parameterName parameter was removed. |
|
44 | * |
|
45 | * @param type |
|
46 | * if not null, the value must be assignable to the specific class |
|
47 | * @throws BindingException |
|
48 | * if the value is not assignable to the specified type |
|
49 | * @since 0.2.9 |
|
50 | */ |
|
51 | ||
52 | Object getObject(Class type); |
|
53 | ||
54 | /** |
|
55 | * Returns true if the value is invariant (not changing; the same value returned each time). |
|
56 | * Static and message bindings are always invariant, and |
|
57 | * {@link org.apache.tapestry.binding.ExpressionBinding}s may be marked invariant (as an |
|
58 | * optimization). |
|
59 | * |
|
60 | * @since 2.0.3 |
|
61 | */ |
|
62 | ||
63 | boolean isInvariant(); |
|
64 | ||
65 | /** |
|
66 | * Updates the value of the binding, if possible. |
|
67 | * |
|
68 | * @exception BindingException |
|
69 | * If the binding is read only. |
|
70 | */ |
|
71 | ||
72 | void setObject(Object value); |
|
73 | ||
74 | /** |
|
75 | * Returns a description of how the binding is used; this description |
|
76 | * is localized and incorporated into some exception messages. |
|
77 | * |
|
78 | * @since 4.0 |
|
79 | */ |
|
80 | ||
81 | String getDescription(); |
|
82 | } |