KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.apache.hivemind.ClassResolver;
18 import org.apache.tapestry.bean.BindingBeanInitializer;
19 import org.apache.tapestry.bean.ExpressionBeanInitializer;
20 import org.apache.tapestry.bean.IBeanInitializer;
21 import org.apache.tapestry.bean.MessageBeanInitializer;
22 import org.apache.tapestry.binding.BindingSource;
23 import org.apache.tapestry.coerce.ValueConverter;
24 import org.apache.tapestry.services.ExpressionEvaluator;
25
26 /**
27  * A Factory used by {@link org.apache.tapestry.parse.SpecificationParser}  to create Tapestry
28  * domain objects.
29  * <p>
30  * The default implementation here creates the expected runtime instances of classes in packages:
31  * <ul>
32  * <li>org.apache.tapestry.spec</li>
33  * <li>org.apache.tapestry.bean</li>
34  * </ul>
35  * <p>
36  * This class is extended by Spindle - the Eclipse Plugin for Tapestry
37  *
38  * @author GWL
39  * @since 1.0.9
40  */

41
42 public class SpecFactory
43 {
44     /**
45      * Creates a concrete instance of {@link ApplicationSpecification}.
46      */

47
48     public IApplicationSpecification createApplicationSpecification()
49     {
50         return new ApplicationSpecification();
51     }
52
53     /**
54      * Creates an instance of {@link LibrarySpecification}.
55      *
56      * @since 2.2
57      */

58
59     public ILibrarySpecification createLibrarySpecification()
60     {
61         return new LibrarySpecification();
62     }
63
64     /**
65      * Returns a new instance of {@link IAssetSpecification}.
66      *
67      * @since 3.0
68      */

69
70     public IAssetSpecification createAssetSpecification()
71     {
72         return new AssetSpecification();
73     }
74
75     /**
76      * Creates a new instance of {@link IBeanSpecification}.
77      *
78      * @since 3.0
79      */

80
81     public IBeanSpecification createBeanSpecification()
82     {
83         return new BeanSpecification();
84     }
85
86     public IBindingSpecification createBindingSpecification()
87     {
88         return new BindingSpecification();
89     }
90
91     /**
92      * Creates a new concrete instance of {@link IListenerBindingSpecification}for the given
93      * language (which is option) and script.
94      *
95      * @since 3.0
96      */

97
98     public IListenerBindingSpecification createListenerBindingSpecification()
99     {
100         return new ListenerBindingSpecification();
101     }
102
103     /**
104      * Creates a concrete instance of {@link IComponentSpecification}.
105      */

106
107     public IComponentSpecification createComponentSpecification()
108     {
109         return new ComponentSpecification();
110     }
111
112     /**
113      * Creates a concrete instance of {@link IContainedComponent}.
114      */

115
116     public IContainedComponent createContainedComponent()
117     {
118         return new ContainedComponent();
119     }
120
121     /**
122      * Creates a concrete instance of {@link ParameterSpecification}.
123      */

124
125     public IParameterSpecification createParameterSpecification()
126     {
127         return new ParameterSpecification();
128     }
129
130     /**
131      * Creates a new instance of {@link ExpressionBeanInitializer}.
132      *
133      * @since 3.0
134      */

135
136     public IBeanInitializer createExpressionBeanInitializer(ExpressionEvaluator evaluator)
137     {
138         return new ExpressionBeanInitializer(evaluator);
139     }
140
141     /** @since 4.0 */
142     public BindingBeanInitializer createBindingBeanInitializer(BindingSource source)
143     {
144         return new BindingBeanInitializer(source);
145     }
146
147     /**
148      * Returns a new instance of {@link MessageBeanInitializer}.
149      *
150      * @since 3.0
151      */

152
153     public IBeanInitializer createMessageBeanInitializer()
154     {
155         return new MessageBeanInitializer();
156     }
157
158     /**
159      * Creates a concrete instance of {@link org.apache.tapestry.spec.IExtensionSpecification}.
160      *
161      * @since 2.2
162      */

163
164     public IExtensionSpecification createExtensionSpecification(ClassResolver resolver,
165             ValueConverter valueConverter)
166     {
167         return new ExtensionSpecification(resolver, valueConverter);
168     }
169
170     /**
171      * Creates a concrete instance of {@link org.apache.tapestry.spec.IPropertySpecification}.
172      *
173      * @since 3.0
174      */

175
176     public IPropertySpecification createPropertySpecification()
177     {
178         return new PropertySpecification();
179     }
180
181     /** @since 4.0 */
182     public InjectSpecification createInjectSpecification()
183     {
184         return new InjectSpecificationImpl();
185     }
186 }
Popular Tags