Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
SpecFactory |
|
| 1.0;1 |
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.binding.BindingSource; |
|
20 | import org.apache.tapestry.coerce.ValueConverter; |
|
21 | ||
22 | /** |
|
23 | * A Factory used by {@link org.apache.tapestry.parse.SpecificationParser} |
|
24 | * to create Tapestry domain objects. |
|
25 | * <p> |
|
26 | * The default implementation here creates the expected runtime instances of |
|
27 | * classes in packages: |
|
28 | * <ul> |
|
29 | * <li>org.apache.tapestry.spec</li> |
|
30 | * <li>org.apache.tapestry.bean</li> |
|
31 | * </ul> |
|
32 | * <p> |
|
33 | * This class is extended by Spindle - the Eclipse Plugin for Tapestry |
|
34 | * |
|
35 | * @author GWL |
|
36 | * @since 1.0.9 |
|
37 | */ |
|
38 | ||
39 | 64 | public class SpecFactory |
40 | { |
|
41 | ||
42 | /** |
|
43 | * Creates a concrete instance of {@link ApplicationSpecification}. |
|
44 | */ |
|
45 | ||
46 | public IApplicationSpecification createApplicationSpecification() |
|
47 | { |
|
48 | 13 | return new ApplicationSpecification(); |
49 | } |
|
50 | ||
51 | /** |
|
52 | * Creates an instance of {@link LibrarySpecification}. |
|
53 | * |
|
54 | * @since 2.2 |
|
55 | */ |
|
56 | ||
57 | public ILibrarySpecification createLibrarySpecification() |
|
58 | { |
|
59 | 7 | return new LibrarySpecification(); |
60 | } |
|
61 | ||
62 | /** |
|
63 | * Returns a new instance of {@link IAssetSpecification}. |
|
64 | * |
|
65 | * @since 3.0 |
|
66 | */ |
|
67 | ||
68 | public IAssetSpecification createAssetSpecification() |
|
69 | { |
|
70 | 8 | return new AssetSpecification(); |
71 | } |
|
72 | ||
73 | /** |
|
74 | * Creates a new instance of {@link IBeanSpecification}. |
|
75 | * |
|
76 | * @since 3.0 |
|
77 | */ |
|
78 | ||
79 | public IBeanSpecification createBeanSpecification() |
|
80 | { |
|
81 | 8 | return new BeanSpecification(); |
82 | } |
|
83 | ||
84 | public IBindingSpecification createBindingSpecification() |
|
85 | { |
|
86 | 12 | return new BindingSpecification(); |
87 | } |
|
88 | ||
89 | /** |
|
90 | * Creates a concrete instance of {@link IComponentSpecification}. |
|
91 | */ |
|
92 | ||
93 | public IComponentSpecification createComponentSpecification() |
|
94 | { |
|
95 | 41 | return new ComponentSpecification(); |
96 | } |
|
97 | ||
98 | /** |
|
99 | * Creates a concrete instance of {@link IContainedComponent}. |
|
100 | */ |
|
101 | ||
102 | public IContainedComponent createContainedComponent() |
|
103 | { |
|
104 | 20 | return new ContainedComponent(); |
105 | } |
|
106 | ||
107 | /** |
|
108 | * Creates a concrete instance of {@link ParameterSpecification}. |
|
109 | */ |
|
110 | ||
111 | public IParameterSpecification createParameterSpecification() |
|
112 | { |
|
113 | 14 | return new ParameterSpecification(); |
114 | } |
|
115 | ||
116 | /** @since 4.0 */ |
|
117 | public BindingBeanInitializer createBindingBeanInitializer( |
|
118 | BindingSource source) |
|
119 | { |
|
120 | 6 | return new BindingBeanInitializer(source); |
121 | } |
|
122 | ||
123 | /** |
|
124 | * Creates a concrete instance of |
|
125 | * {@link org.apache.tapestry.spec.IExtensionSpecification}. |
|
126 | * |
|
127 | * @since 2.2 |
|
128 | */ |
|
129 | ||
130 | public IExtensionSpecification createExtensionSpecification( |
|
131 | ClassResolver resolver, ValueConverter valueConverter) |
|
132 | { |
|
133 | 8 | return new ExtensionSpecification(resolver, valueConverter); |
134 | } |
|
135 | ||
136 | /** |
|
137 | * Creates a concrete instance of |
|
138 | * {@link org.apache.tapestry.spec.IPropertySpecification}. |
|
139 | * |
|
140 | * @since 3.0 |
|
141 | */ |
|
142 | ||
143 | public IPropertySpecification createPropertySpecification() |
|
144 | { |
|
145 | 8 | return new PropertySpecification(); |
146 | } |
|
147 | ||
148 | /** @since 4.0 */ |
|
149 | public InjectSpecification createInjectSpecification() |
|
150 | { |
|
151 | 2 | return new InjectSpecificationImpl(); |
152 | } |
|
153 | } |