Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BobberArchetype |
|
| 1.7142857142857142;1.714 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package com.javaforge.bobber.archetype.model; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * Describes the assembly layout and packaging. | |
15 | * | |
16 | * @version $Revision$ $Date$ | |
17 | */ | |
18 | 0 | public class BobberArchetype implements java.io.Serializable { |
19 | ||
20 | ||
21 | //--------------------------/ | |
22 | //- Class/Member Variables -/ | |
23 | //--------------------------/ | |
24 | ||
25 | /** | |
26 | * Field id. | |
27 | */ | |
28 | private String id; | |
29 | ||
30 | /** | |
31 | * Field allowPartial. | |
32 | */ | |
33 | 0 | private boolean allowPartial = false; |
34 | ||
35 | /** | |
36 | * Field variables. | |
37 | */ | |
38 | private java.util.List variables; | |
39 | ||
40 | /** | |
41 | * Field templates. | |
42 | */ | |
43 | private java.util.List templates; | |
44 | ||
45 | ||
46 | //-----------/ | |
47 | //- Methods -/ | |
48 | //-----------/ | |
49 | ||
50 | /** | |
51 | * Method addTemplate. | |
52 | * | |
53 | * @param template | |
54 | */ | |
55 | public void addTemplate(Template template) | |
56 | { | |
57 | 0 | if ( !(template instanceof Template) ) |
58 | { | |
59 | 0 | throw new ClassCastException( "BobberArchetype.addTemplates(template) parameter must be instanceof " + Template.class.getName() ); |
60 | } | |
61 | 0 | getTemplates().add( template ); |
62 | 0 | } //-- void addTemplate(Template) |
63 | ||
64 | /** | |
65 | * Method addVariable. | |
66 | * | |
67 | * @param variable | |
68 | */ | |
69 | public void addVariable(Variable variable) | |
70 | { | |
71 | 0 | if ( !(variable instanceof Variable) ) |
72 | { | |
73 | 0 | throw new ClassCastException( "BobberArchetype.addVariables(variable) parameter must be instanceof " + Variable.class.getName() ); |
74 | } | |
75 | 0 | getVariables().add( variable ); |
76 | 0 | } //-- void addVariable(Variable) |
77 | ||
78 | /** | |
79 | * Get the id field. | |
80 | * | |
81 | * @return String | |
82 | */ | |
83 | public String getId() | |
84 | { | |
85 | 0 | return this.id; |
86 | } //-- String getId() | |
87 | ||
88 | /** | |
89 | * Method getTemplates. | |
90 | * | |
91 | * @return java.util.List | |
92 | */ | |
93 | public java.util.List getTemplates() | |
94 | { | |
95 | 0 | if ( this.templates == null ) |
96 | { | |
97 | 0 | this.templates = new java.util.ArrayList(); |
98 | } | |
99 | ||
100 | 0 | return this.templates; |
101 | } //-- java.util.List getTemplates() | |
102 | ||
103 | /** | |
104 | * Method getVariables. | |
105 | * | |
106 | * @return java.util.List | |
107 | */ | |
108 | public java.util.List getVariables() | |
109 | { | |
110 | 0 | if ( this.variables == null ) |
111 | { | |
112 | 0 | this.variables = new java.util.ArrayList(); |
113 | } | |
114 | ||
115 | 0 | return this.variables; |
116 | } //-- java.util.List getVariables() | |
117 | ||
118 | /** | |
119 | * Get the allowPartial field. | |
120 | * | |
121 | * @return boolean | |
122 | */ | |
123 | public boolean isAllowPartial() | |
124 | { | |
125 | 0 | return this.allowPartial; |
126 | } //-- boolean isAllowPartial() | |
127 | ||
128 | /** | |
129 | * Method removeTemplate. | |
130 | * | |
131 | * @param template | |
132 | */ | |
133 | public void removeTemplate(Template template) | |
134 | { | |
135 | 0 | if ( !(template instanceof Template) ) |
136 | { | |
137 | 0 | throw new ClassCastException( "BobberArchetype.removeTemplates(template) parameter must be instanceof " + Template.class.getName() ); |
138 | } | |
139 | 0 | getTemplates().remove( template ); |
140 | 0 | } //-- void removeTemplate(Template) |
141 | ||
142 | /** | |
143 | * Method removeVariable. | |
144 | * | |
145 | * @param variable | |
146 | */ | |
147 | public void removeVariable(Variable variable) | |
148 | { | |
149 | 0 | if ( !(variable instanceof Variable) ) |
150 | { | |
151 | 0 | throw new ClassCastException( "BobberArchetype.removeVariables(variable) parameter must be instanceof " + Variable.class.getName() ); |
152 | } | |
153 | 0 | getVariables().remove( variable ); |
154 | 0 | } //-- void removeVariable(Variable) |
155 | ||
156 | /** | |
157 | * Set the allowPartial field. | |
158 | * | |
159 | * @param allowPartial | |
160 | */ | |
161 | public void setAllowPartial(boolean allowPartial) | |
162 | { | |
163 | 0 | this.allowPartial = allowPartial; |
164 | 0 | } //-- void setAllowPartial(boolean) |
165 | ||
166 | /** | |
167 | * Set the id field. | |
168 | * | |
169 | * @param id | |
170 | */ | |
171 | public void setId(String id) | |
172 | { | |
173 | 0 | this.id = id; |
174 | 0 | } //-- void setId(String) |
175 | ||
176 | /** | |
177 | * Set | |
178 | * list of all the templates in the archetype that | |
179 | * need to | |
180 | * . | |
181 | * | |
182 | * @param templates | |
183 | */ | |
184 | public void setTemplates(java.util.List templates) | |
185 | { | |
186 | 0 | this.templates = templates; |
187 | 0 | } //-- void setTemplates(java.util.List) |
188 | ||
189 | /** | |
190 | * Set | |
191 | * variable expressions that will use the | |
192 | * System.properties values to be used as input into the | |
193 | * velocity template engine | |
194 | * . | |
195 | * | |
196 | * @param variables | |
197 | */ | |
198 | public void setVariables(java.util.List variables) | |
199 | { | |
200 | 0 | this.variables = variables; |
201 | 0 | } //-- void setVariables(java.util.List) |
202 | ||
203 | ||
204 | 0 | private String modelEncoding = "UTF-8"; |
205 | ||
206 | /** | |
207 | * Set an encoding used for reading/writing the model. | |
208 | * | |
209 | * @param modelEncoding the encoding used when reading/writing the model. | |
210 | */ | |
211 | public void setModelEncoding( String modelEncoding ) | |
212 | { | |
213 | 0 | this.modelEncoding = modelEncoding; |
214 | 0 | } |
215 | ||
216 | /** | |
217 | * @return the current encoding used when reading/writing this model. | |
218 | */ | |
219 | public String getModelEncoding() | |
220 | { | |
221 | 0 | return modelEncoding; |
222 | } | |
223 | } |