KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > spec > BeanSpecification


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 JavaDoc;
18 import java.util.List JavaDoc;
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 JavaDoc className;
32
33     protected BeanLifecycle lifecycle;
34
35     /** @since 1.0.9 * */
36     private String JavaDoc description;
37
38     /** @since 4.0 */
39
40     private String JavaDoc _propertyName;
41
42     /**
43      * A List of {@link IBeanInitializer}.
44      */

45
46     protected List JavaDoc initializers;
47
48     public String JavaDoc getClassName()
49     {
50         return className;
51     }
52
53     public BeanLifecycle getLifecycle()
54     {
55         return lifecycle;
56     }
57
58     /**
59      * @since 1.0.5
60      */

61
62     public void addInitializer(IBeanInitializer initializer)
63     {
64         if (initializers == null)
65             initializers = new ArrayList JavaDoc();
66
67         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     public List JavaDoc getInitializers()
78     {
79         return initializers;
80     }
81
82     public String JavaDoc toString()
83     {
84         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc("BeanSpecification[");
85
86         buffer.append(className);
87         buffer.append(", lifecycle ");
88         buffer.append(lifecycle.getName());
89
90         if (initializers != null && initializers.size() > 0)
91         {
92             buffer.append(", ");
93             buffer.append(initializers.size());
94             buffer.append(" initializers");
95         }
96
97         buffer.append(']');
98
99         return buffer.toString();
100     }
101
102     public String JavaDoc getDescription()
103     {
104         return description;
105     }
106
107     public void setDescription(String JavaDoc desc)
108     {
109         description = desc;
110     }
111
112     /** @since 3.0 * */
113
114     public void setClassName(String JavaDoc className)
115     {
116         this.className = className;
117     }
118
119     /** @since 3.0 * */
120
121     public void setLifecycle(BeanLifecycle lifecycle)
122     {
123         this.lifecycle = lifecycle;
124     }
125
126     /** @since 4.0 */
127     public String JavaDoc getPropertyName()
128     {
129         return _propertyName;
130     }
131
132     /** @since 4.0 */
133     public void setPropertyName(String JavaDoc propertyName)
134     {
135         _propertyName = propertyName;
136     }
137 }
Popular Tags