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