Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DescriptionReceiver |
|
| 1.0;1 |
1 | // Copyright 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.describe; | |
16 | ||
17 | import java.util.Collection; | |
18 | ||
19 | /** | |
20 | * An object that is provided with a description of another object. The receiver | |
21 | * will format this information. | |
22 | * | |
23 | * @author Howard M. Lewis Ship | |
24 | * @since 4.0 | |
25 | */ | |
26 | public interface DescriptionReceiver | |
27 | { | |
28 | ||
29 | /** | |
30 | * Invoke to describe another object instead of the current object. | |
31 | */ | |
32 | ||
33 | void describeAlternate(Object alternate); | |
34 | ||
35 | /** | |
36 | * Provides a title for the object; usually the object's class name. | |
37 | * | |
38 | * @throws IllegalStateException | |
39 | * if called more than once (for the same object) | |
40 | */ | |
41 | void title(String title); | |
42 | ||
43 | /** | |
44 | * Starts a new sub-section within the description. A description may have | |
45 | * any number of sections (but sections do not nest). A second title is only | |
46 | * emitted when the firstproperty within the section is emitted. | |
47 | * | |
48 | * @throws IllegalStateException | |
49 | * if called before invoking {@link #title(String)}. | |
50 | */ | |
51 | void section(String section); | |
52 | ||
53 | /** | |
54 | * Emits a key/value pair, describing a property of the object. The value | |
55 | * will itself be described. This method is overridden for scalar property | |
56 | * types. | |
57 | * | |
58 | * @throws IllegalStateException | |
59 | * if called before invoking {@link #title(String)} | |
60 | */ | |
61 | void property(String key, Object value); | |
62 | ||
63 | void property(String key, boolean value); | |
64 | ||
65 | void property(String key, byte value); | |
66 | ||
67 | void property(String key, short value); | |
68 | ||
69 | void property(String key, int value); | |
70 | ||
71 | void property(String key, long value); | |
72 | ||
73 | void property(String key, float value); | |
74 | ||
75 | void property(String key, double value); | |
76 | ||
77 | void property(String key, char value); | |
78 | ||
79 | /** | |
80 | * Emits a list of values for the key. Each value will be described. Emits | |
81 | * nothing if the array is null. | |
82 | */ | |
83 | void array(String key, Object[] values); | |
84 | ||
85 | /** | |
86 | * As with {@link #array(String, Object[])}, but the values are in a | |
87 | * collection (which may be null, to emit nothing). | |
88 | */ | |
89 | ||
90 | void collection(String key, Collection values); | |
91 | } |