View Javadoc

1   /*
2    *   Copyright (C) Christian Schulte, 2005-206
3    *   All rights reserved.
4    *
5    *   Redistribution and use in source and binary forms, with or without
6    *   modification, are permitted provided that the following conditions
7    *   are met:
8    *
9    *     o Redistributions of source code must retain the above copyright
10   *       notice, this list of conditions and the following disclaimer.
11   *
12   *     o Redistributions in binary form must reproduce the above copyright
13   *       notice, this list of conditions and the following disclaimer in
14   *       the documentation and/or other materials provided with the
15   *       distribution.
16   *
17   *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18   *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19   *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20   *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21   *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22   *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23   *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24   *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25   *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26   *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27   *
28   *   $JOMC: TestModletProvider.java 4654 2012-11-15 22:28:26Z schulte $
29   *
30   */
31  package org.jomc.modlet.test.support;
32  
33  import java.net.URL;
34  import org.jomc.modlet.ModelContext;
35  import org.jomc.modlet.ModelException;
36  import org.jomc.modlet.ModelProcessor;
37  import org.jomc.modlet.ModelProvider;
38  import org.jomc.modlet.ModelValidator;
39  import org.jomc.modlet.Modlet;
40  import org.jomc.modlet.ModletProvider;
41  import org.jomc.modlet.Modlets;
42  import org.jomc.modlet.Service;
43  import org.jomc.modlet.Services;
44  
45  /**
46   * {@code ModletProvider} test implementation.
47   *
48   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
49   * @version $JOMC: TestModletProvider.java 4654 2012-11-15 22:28:26Z schulte $
50   */
51  public final class TestModletProvider implements ModletProvider
52  {
53  
54      private boolean booleanProperty;
55  
56      private boolean boxedBooleanProperty;
57  
58      private Boolean unboxedBooleanProperty;
59  
60      private char characterProperty;
61  
62      private char boxedCharacterProperty;
63  
64      private Character unboxedCharacterProperty;
65  
66      private byte byteProperty;
67  
68      private byte boxedByteProperty;
69  
70      private Byte unboxedByteProperty;
71  
72      private short shortProperty;
73  
74      private short boxedShortProperty;
75  
76      private Short unboxedShortProperty;
77  
78      private int intProperty;
79  
80      private int boxedIntProperty;
81  
82      private Integer unboxedIntProperty;
83  
84      private long longProperty;
85  
86      private long boxedLongProperty;
87  
88      private Long unboxedLongProperty;
89  
90      private float floatProperty;
91  
92      private float boxedFloatProperty;
93  
94      private Float unboxedFloatProperty;
95  
96      private double doubleProperty;
97  
98      private double boxedDoubleProperty;
99  
100     private Double unboxedDoubleProperty;
101 
102     private String stringProperty;
103 
104     private URL urlProperty;
105 
106     private Thread.State enumProperty;
107 
108     private Object objectProperty;
109 
110     private String stringPropertyWithoutSetter;
111 
112     private String stringPropertyWithoutGetter;
113 
114     private Math unsupportedPropertyType;
115 
116     private InstantiationExceptionPropertyType instantiationExceptionProperty;
117 
118     private InvocationTargetExceptionPropertyType invocationTargetExceptionProperty;
119 
120     public TestModletProvider()
121     {
122         super();
123     }
124 
125     public Modlets findModlets( final ModelContext context ) throws ModelException
126     {
127         final Modlets modlets = new Modlets();
128         final Modlet modlet = new Modlet();
129         modlets.getModlet().add( modlet );
130         modlet.setName( TestModletProvider.class.getName() );
131         modlet.setModel( TestModletProvider.class.getName() );
132         modlet.setServices( new Services() );
133 
134         Service s = new Service();
135         s.setClazz( TestModelProvider.class.getName() );
136         s.setIdentifier( ModelProvider.class.getName() );
137         modlet.getServices().getService().add( s );
138 
139         s = new Service();
140         s.setClazz( TestModelProcessor.class.getName() );
141         s.setIdentifier( ModelProcessor.class.getName() );
142         modlet.getServices().getService().add( s );
143 
144         s = new Service();
145         s.setClazz( TestModelValidator.class.getName() );
146         s.setIdentifier( ModelValidator.class.getName() );
147         modlet.getServices().getService().add( s );
148 
149         context.setAttribute( TestModletProvider.class.getName(), this );
150         return modlets;
151     }
152 
153     public boolean isBooleanProperty()
154     {
155         return this.booleanProperty;
156     }
157 
158     public void setBooleanProperty( final boolean value )
159     {
160         this.booleanProperty = value;
161     }
162 
163     public Boolean isBoxedBooleanProperty()
164     {
165         return this.boxedBooleanProperty;
166     }
167 
168     public void setBoxedBooleanProperty( final boolean value )
169     {
170         this.boxedBooleanProperty = value;
171     }
172 
173     public boolean isUnboxedBooleanProperty()
174     {
175         return this.unboxedBooleanProperty ? true : false;
176     }
177 
178     public void setUnboxedBooleanProperty( final Boolean value )
179     {
180         this.unboxedBooleanProperty = value;
181     }
182 
183     public char getCharacterProperty()
184     {
185         return this.characterProperty;
186     }
187 
188     public void setCharacterProperty( final char value )
189     {
190         this.characterProperty = value;
191     }
192 
193     public Character getBoxedCharacterProperty()
194     {
195         return this.boxedCharacterProperty;
196     }
197 
198     public void setBoxedCharacterProperty( final char value )
199     {
200         this.boxedCharacterProperty = value;
201     }
202 
203     public char getUnboxedCharacterProperty()
204     {
205         return this.unboxedCharacterProperty;
206     }
207 
208     public void setUnboxedCharacterProperty( final Character value )
209     {
210         this.unboxedCharacterProperty = value;
211     }
212 
213     public byte getByteProperty()
214     {
215         return this.byteProperty;
216     }
217 
218     public void setByteProperty( final byte value )
219     {
220         this.byteProperty = value;
221     }
222 
223     public Byte getBoxedByteProperty()
224     {
225         return this.boxedByteProperty;
226     }
227 
228     public void setBoxedByteProperty( final byte value )
229     {
230         this.boxedByteProperty = value;
231     }
232 
233     public byte getUnboxedByteProperty()
234     {
235         return this.unboxedByteProperty;
236     }
237 
238     public void setUnboxedByteProperty( final Byte value )
239     {
240         this.unboxedByteProperty = value;
241     }
242 
243     public short getShortProperty()
244     {
245         return this.shortProperty;
246     }
247 
248     public void setShortProperty( final short value )
249     {
250         this.shortProperty = value;
251     }
252 
253     public Short getBoxedShortProperty()
254     {
255         return this.boxedShortProperty;
256     }
257 
258     public void setBoxedShortProperty( final short value )
259     {
260         this.boxedShortProperty = value;
261     }
262 
263     public short getUnboxedShortProperty()
264     {
265         return this.unboxedShortProperty;
266     }
267 
268     public void setUnboxedShortProperty( final Short value )
269     {
270         this.unboxedShortProperty = value;
271     }
272 
273     public int getIntProperty()
274     {
275         return this.intProperty;
276     }
277 
278     public void setIntProperty( final int value )
279     {
280         this.intProperty = value;
281     }
282 
283     public Integer getBoxedIntProperty()
284     {
285         return this.boxedIntProperty;
286     }
287 
288     public void setBoxedIntProperty( final int value )
289     {
290         this.boxedIntProperty = value;
291     }
292 
293     public int getUnboxedIntProperty()
294     {
295         return this.unboxedIntProperty;
296     }
297 
298     public void setUnboxedIntProperty( final Integer value )
299     {
300         this.unboxedIntProperty = value;
301     }
302 
303     public long getLongProperty()
304     {
305         return this.longProperty;
306     }
307 
308     public void setLongProperty( final long value )
309     {
310         this.longProperty = value;
311     }
312 
313     public Long getBoxedLongProperty()
314     {
315         return this.boxedLongProperty;
316     }
317 
318     public void setBoxedLongProperty( final long value )
319     {
320         this.boxedLongProperty = value;
321     }
322 
323     public long getUnboxedLongProperty()
324     {
325         return this.unboxedLongProperty;
326     }
327 
328     public void setUnboxedLongProperty( final Long value )
329     {
330         this.unboxedLongProperty = value;
331     }
332 
333     public float getFloatProperty()
334     {
335         return this.floatProperty;
336     }
337 
338     public void setFloatProperty( final float value )
339     {
340         this.floatProperty = value;
341     }
342 
343     public Float getBoxedFloatProperty()
344     {
345         return this.boxedFloatProperty;
346     }
347 
348     public void setBoxedFloatProperty( final float value )
349     {
350         this.boxedFloatProperty = value;
351     }
352 
353     public float getUnboxedFloatProperty()
354     {
355         return this.unboxedFloatProperty;
356     }
357 
358     public void setUnboxedFloatProperty( final Float value )
359     {
360         this.unboxedFloatProperty = value;
361     }
362 
363     public double getDoubleProperty()
364     {
365         return this.doubleProperty;
366     }
367 
368     public void setDoubleProperty( final double value )
369     {
370         this.doubleProperty = value;
371     }
372 
373     public Double getBoxedDoubleProperty()
374     {
375         return this.boxedDoubleProperty;
376     }
377 
378     public void setBoxedDoubleProperty( final double value )
379     {
380         this.boxedDoubleProperty = value;
381     }
382 
383     public double getUnboxedDoubleProperty()
384     {
385         return this.unboxedDoubleProperty;
386     }
387 
388     public void setUnboxedDoubleProperty( final Double value )
389     {
390         this.unboxedDoubleProperty = value;
391     }
392 
393     public String getStringProperty()
394     {
395         return this.stringProperty;
396     }
397 
398     public void setStringProperty( final String value )
399     {
400         this.stringProperty = value;
401     }
402 
403     public String getStringPropertyWithoutSetter()
404     {
405         return this.stringPropertyWithoutSetter;
406     }
407 
408     public void setStringPropertyWithoutGetter( final String value )
409     {
410         this.stringPropertyWithoutGetter = value;
411     }
412 
413     public URL getUrlProperty()
414     {
415         return this.urlProperty;
416     }
417 
418     public void setUrlProperty( final URL value )
419     {
420         this.urlProperty = value;
421     }
422 
423     public Thread.State getEnumProperty()
424     {
425         return this.enumProperty;
426     }
427 
428     public void setEnumProperty( final Thread.State value )
429     {
430         this.enumProperty = value;
431     }
432 
433     public Object getObjectProperty()
434     {
435         return this.objectProperty;
436     }
437 
438     public void setObjectProperty( final Object value )
439     {
440         this.objectProperty = value;
441     }
442 
443     public Math getUnsupportedPropertyType()
444     {
445         return this.unsupportedPropertyType;
446     }
447 
448     public void setUnsupportedPropertyType( final Math value )
449     {
450         this.unsupportedPropertyType = value;
451     }
452 
453     public InstantiationExceptionPropertyType getInstantiationExceptionProperty()
454     {
455         return this.instantiationExceptionProperty;
456     }
457 
458     public void setInstantiationExceptionProperty( final InstantiationExceptionPropertyType value )
459     {
460         this.instantiationExceptionProperty = value;
461     }
462 
463     public InvocationTargetExceptionPropertyType getInvocationTargetExceptionProperty()
464     {
465         return this.invocationTargetExceptionProperty;
466     }
467 
468     public void setInvocationTargetExceptionProperty( final InvocationTargetExceptionPropertyType value )
469     {
470         this.invocationTargetExceptionProperty = value;
471     }
472 
473 }