|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover 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 | 69 |
public String getClassName()
|
49 |
{ |
|
50 | 69 |
return className;
|
51 |
} |
|
52 |
|
|
53 | 138 |
public BeanLifecycle getLifecycle()
|
54 |
{ |
|
55 | 138 |
return lifecycle;
|
56 |
} |
|
57 |
|
|
58 |
/**
|
|
59 |
* @since 1.0.5
|
|
60 |
*/
|
|
61 |
|
|
62 | 14 |
public void addInitializer(IBeanInitializer initializer) |
63 |
{ |
|
64 | 14 |
if (initializers == null) |
65 | 6 |
initializers = new ArrayList();
|
66 |
|
|
67 | 14 |
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 | 73 |
public List getInitializers()
|
78 |
{ |
|
79 | 73 |
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 | 44 |
public void setClassName(String className) |
115 |
{ |
|
116 | 44 |
this.className = className;
|
117 |
} |
|
118 |
|
|
119 |
/** @since 3.0 * */
|
|
120 |
|
|
121 | 44 |
public void setLifecycle(BeanLifecycle lifecycle) |
122 |
{ |
|
123 | 44 |
this.lifecycle = lifecycle;
|
124 |
} |
|
125 |
|
|
126 |
/** @since 4.0 */
|
|
127 | 41 |
public String getPropertyName()
|
128 |
{ |
|
129 | 41 |
return _propertyName;
|
130 |
} |
|
131 |
|
|
132 |
/** @since 4.0 */
|
|
133 | 47 |
public void setPropertyName(String propertyName) |
134 |
{ |
|
135 | 47 |
_propertyName = propertyName; |
136 |
} |
|
137 |
} |
|