|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
BeanSpecification.java | 50% | 54.5% | 90.9% | 64.9% |
|
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.spec; | |
16 | ||
17 | import java.util.ArrayList; | |
18 | import java.util.List; | |
19 | ||
20 | import org.apache.tapestry.bean.IBeanInitializer; | |
21 | ||
22 | /** | |
23 | * A specification of a helper bean for a component. | |
24 | * | |
25 | * @author Howard Lewis Ship | |
26 | * @since 1.0.4 | |
27 | */ | |
28 | ||
29 | public class BeanSpecification extends LocatablePropertyHolder implements IBeanSpecification | |
30 | { | |
31 | protected String className; | |
32 | ||
33 | protected BeanLifecycle lifecycle; | |
34 | ||
35 | /** @since 1.0.9 * */ | |
36 | private String description; | |
37 | ||
38 | /** @since 4.0 */ | |
39 | ||
40 | private String _propertyName; | |
41 | ||
42 | /** | |
43 | * A List of {@link IBeanInitializer}. | |
44 | */ | |
45 | ||
46 | protected List initializers; | |
47 | ||
48 | 85 | public String getClassName() |
49 | { | |
50 | 85 | return className; |
51 | } | |
52 | ||
53 | 167 | public BeanLifecycle getLifecycle() |
54 | { | |
55 | 167 | return lifecycle; |
56 | } | |
57 | ||
58 | /** | |
59 | * @since 1.0.5 | |
60 | */ | |
61 | ||
62 | 10 | public void addInitializer(IBeanInitializer initializer) |
63 | { | |
64 | 10 | if (initializers == null) |
65 | 5 | initializers = new ArrayList(); |
66 | ||
67 | 10 | initializers.add(initializer); |
68 | } | |
69 | ||
70 | /** | |
71 | * Returns the {@link List}of {@link IBeanInitializer}s. The caller should not modify this | |
72 | * value!. May return null if there are no initializers. | |
73 | * | |
74 | * @since 1.0.5 | |
75 | */ | |
76 | ||
77 | 90 | public List getInitializers() |
78 | { | |
79 | 90 | return initializers; |
80 | } | |
81 | ||
82 | 0 | public String toString() |
83 | { | |
84 | 0 | StringBuffer buffer = new StringBuffer("BeanSpecification["); |
85 | ||
86 | 0 | buffer.append(className); |
87 | 0 | buffer.append(", lifecycle "); |
88 | 0 | buffer.append(lifecycle.getName()); |
89 | ||
90 | 0 | if (initializers != null && initializers.size() > 0) |
91 | { | |
92 | 0 | buffer.append(", "); |
93 | 0 | buffer.append(initializers.size()); |
94 | 0 | buffer.append(" initializers"); |
95 | } | |
96 | ||
97 | 0 | buffer.append(']'); |
98 | ||
99 | 0 | return buffer.toString(); |
100 | } | |
101 | ||
102 | 1 | public String getDescription() |
103 | { | |
104 | 1 | return description; |
105 | } | |
106 | ||
107 | 2 | public void setDescription(String desc) |
108 | { | |
109 | 2 | description = desc; |
110 | } | |
111 | ||
112 | /** @since 3.0 * */ | |
113 | ||
114 | 35 | public void setClassName(String className) |
115 | { | |
116 | 35 | this.className = className; |
117 | } | |
118 | ||
119 | /** @since 3.0 * */ | |
120 | ||
121 | 35 | public void setLifecycle(BeanLifecycle lifecycle) |
122 | { | |
123 | 35 | this.lifecycle = lifecycle; |
124 | } | |
125 | ||
126 | /** @since 4.0 */ | |
127 | 67 | public String getPropertyName() |
128 | { | |
129 | 67 | return _propertyName; |
130 | } | |
131 | ||
132 | /** @since 4.0 */ | |
133 | 38 | public void setPropertyName(String propertyName) |
134 | { | |
135 | 38 | _propertyName = propertyName; |
136 | } | |
137 | } |
|