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: TestUnmarshallerListener.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 javax.xml.bind.Unmarshaller;
35  
36  /**
37   * {@code Unmarshaller.Listener} test implementation.
38   *
39   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
40   * @version $JOMC: TestUnmarshallerListener.java 4654 2012-11-15 22:28:26Z schulte $
41   */
42  public final class TestUnmarshallerListener extends Unmarshaller.Listener
43  {
44  
45      private boolean booleanProperty;
46  
47      private boolean boxedBooleanProperty;
48  
49      private Boolean unboxedBooleanProperty;
50  
51      private char characterProperty;
52  
53      private char boxedCharacterProperty;
54  
55      private Character unboxedCharacterProperty;
56  
57      private byte byteProperty;
58  
59      private byte boxedByteProperty;
60  
61      private Byte unboxedByteProperty;
62  
63      private short shortProperty;
64  
65      private short boxedShortProperty;
66  
67      private Short unboxedShortProperty;
68  
69      private int intProperty;
70  
71      private int boxedIntProperty;
72  
73      private Integer unboxedIntProperty;
74  
75      private long longProperty;
76  
77      private long boxedLongProperty;
78  
79      private Long unboxedLongProperty;
80  
81      private float floatProperty;
82  
83      private float boxedFloatProperty;
84  
85      private Float unboxedFloatProperty;
86  
87      private double doubleProperty;
88  
89      private double boxedDoubleProperty;
90  
91      private Double unboxedDoubleProperty;
92  
93      private String stringProperty;
94  
95      private URL urlProperty;
96  
97      private Thread.State enumProperty;
98  
99      private Object objectProperty;
100 
101     private String stringPropertyWithoutSetter;
102 
103     private String stringPropertyWithoutGetter;
104 
105     private Math unsupportedPropertyType;
106 
107     private InstantiationExceptionPropertyType instantiationExceptionProperty;
108 
109     private InvocationTargetExceptionPropertyType invocationTargetExceptionProperty;
110 
111     /** Creates a new {@code TestUnmarshallerListener} instance. */
112     public TestUnmarshallerListener()
113     {
114         super();
115     }
116 
117     @Override
118     public void beforeUnmarshal( final Object target, final Object parent )
119     {
120         System.out.println( this.getClass().getName() + ": beforeUnmarshal(" + target + ", " + parent + ")" );
121     }
122 
123     @Override
124     public void afterUnmarshal( final Object target, final Object parent )
125     {
126         System.out.println( this.getClass().getName() + ": afterUnmarshal(" + target + ", " + parent + ")" );
127     }
128 
129     public boolean isBooleanProperty()
130     {
131         return this.booleanProperty;
132     }
133 
134     public void setBooleanProperty( final boolean value )
135     {
136         this.booleanProperty = value;
137     }
138 
139     public Boolean isBoxedBooleanProperty()
140     {
141         return this.boxedBooleanProperty;
142     }
143 
144     public void setBoxedBooleanProperty( final boolean value )
145     {
146         this.boxedBooleanProperty = value;
147     }
148 
149     public boolean isUnboxedBooleanProperty()
150     {
151         return this.unboxedBooleanProperty ? true : false;
152     }
153 
154     public void setUnboxedBooleanProperty( final Boolean value )
155     {
156         this.unboxedBooleanProperty = value;
157     }
158 
159     public char getCharacterProperty()
160     {
161         return this.characterProperty;
162     }
163 
164     public void setCharacterProperty( final char value )
165     {
166         this.characterProperty = value;
167     }
168 
169     public Character getBoxedCharacterProperty()
170     {
171         return this.boxedCharacterProperty;
172     }
173 
174     public void setBoxedCharacterProperty( final char value )
175     {
176         this.boxedCharacterProperty = value;
177     }
178 
179     public char getUnboxedCharacterProperty()
180     {
181         return this.unboxedCharacterProperty;
182     }
183 
184     public void setUnboxedCharacterProperty( final Character value )
185     {
186         this.unboxedCharacterProperty = value;
187     }
188 
189     public byte getByteProperty()
190     {
191         return this.byteProperty;
192     }
193 
194     public void setByteProperty( final byte value )
195     {
196         this.byteProperty = value;
197     }
198 
199     public Byte getBoxedByteProperty()
200     {
201         return this.boxedByteProperty;
202     }
203 
204     public void setBoxedByteProperty( final byte value )
205     {
206         this.boxedByteProperty = value;
207     }
208 
209     public byte getUnboxedByteProperty()
210     {
211         return this.unboxedByteProperty;
212     }
213 
214     public void setUnboxedByteProperty( final Byte value )
215     {
216         this.unboxedByteProperty = value;
217     }
218 
219     public short getShortProperty()
220     {
221         return this.shortProperty;
222     }
223 
224     public void setShortProperty( final short value )
225     {
226         this.shortProperty = value;
227     }
228 
229     public Short getBoxedShortProperty()
230     {
231         return this.boxedShortProperty;
232     }
233 
234     public void setBoxedShortProperty( final short value )
235     {
236         this.boxedShortProperty = value;
237     }
238 
239     public short getUnboxedShortProperty()
240     {
241         return this.unboxedShortProperty;
242     }
243 
244     public void setUnboxedShortProperty( final Short value )
245     {
246         this.unboxedShortProperty = value;
247     }
248 
249     public int getIntProperty()
250     {
251         return this.intProperty;
252     }
253 
254     public void setIntProperty( final int value )
255     {
256         this.intProperty = value;
257     }
258 
259     public Integer getBoxedIntProperty()
260     {
261         return this.boxedIntProperty;
262     }
263 
264     public void setBoxedIntProperty( final int value )
265     {
266         this.boxedIntProperty = value;
267     }
268 
269     public int getUnboxedIntProperty()
270     {
271         return this.unboxedIntProperty;
272     }
273 
274     public void setUnboxedIntProperty( final Integer value )
275     {
276         this.unboxedIntProperty = value;
277     }
278 
279     public long getLongProperty()
280     {
281         return this.longProperty;
282     }
283 
284     public void setLongProperty( final long value )
285     {
286         this.longProperty = value;
287     }
288 
289     public Long getBoxedLongProperty()
290     {
291         return this.boxedLongProperty;
292     }
293 
294     public void setBoxedLongProperty( final long value )
295     {
296         this.boxedLongProperty = value;
297     }
298 
299     public long getUnboxedLongProperty()
300     {
301         return this.unboxedLongProperty;
302     }
303 
304     public void setUnboxedLongProperty( final Long value )
305     {
306         this.unboxedLongProperty = value;
307     }
308 
309     public float getFloatProperty()
310     {
311         return this.floatProperty;
312     }
313 
314     public void setFloatProperty( final float value )
315     {
316         this.floatProperty = value;
317     }
318 
319     public Float getBoxedFloatProperty()
320     {
321         return this.boxedFloatProperty;
322     }
323 
324     public void setBoxedFloatProperty( final float value )
325     {
326         this.boxedFloatProperty = value;
327     }
328 
329     public float getUnboxedFloatProperty()
330     {
331         return this.unboxedFloatProperty;
332     }
333 
334     public void setUnboxedFloatProperty( final Float value )
335     {
336         this.unboxedFloatProperty = value;
337     }
338 
339     public double getDoubleProperty()
340     {
341         return this.doubleProperty;
342     }
343 
344     public void setDoubleProperty( final double value )
345     {
346         this.doubleProperty = value;
347     }
348 
349     public Double getBoxedDoubleProperty()
350     {
351         return this.boxedDoubleProperty;
352     }
353 
354     public void setBoxedDoubleProperty( final double value )
355     {
356         this.boxedDoubleProperty = value;
357     }
358 
359     public double getUnboxedDoubleProperty()
360     {
361         return this.unboxedDoubleProperty;
362     }
363 
364     public void setUnboxedDoubleProperty( final Double value )
365     {
366         this.unboxedDoubleProperty = value;
367     }
368 
369     public String getStringProperty()
370     {
371         return this.stringProperty;
372     }
373 
374     public void setStringProperty( final String value )
375     {
376         this.stringProperty = value;
377     }
378 
379     public String getStringPropertyWithoutSetter()
380     {
381         return this.stringPropertyWithoutSetter;
382     }
383 
384     public void setStringPropertyWithoutGetter( final String value )
385     {
386         this.stringPropertyWithoutGetter = value;
387     }
388 
389     public URL getUrlProperty()
390     {
391         return this.urlProperty;
392     }
393 
394     public void setUrlProperty( final URL value )
395     {
396         this.urlProperty = value;
397     }
398 
399     public Thread.State getEnumProperty()
400     {
401         return this.enumProperty;
402     }
403 
404     public void setEnumProperty( final Thread.State value )
405     {
406         this.enumProperty = value;
407     }
408 
409     public Object getObjectProperty()
410     {
411         return this.objectProperty;
412     }
413 
414     public void setObjectProperty( final Object value )
415     {
416         this.objectProperty = value;
417     }
418 
419     public Math getUnsupportedPropertyType()
420     {
421         return this.unsupportedPropertyType;
422     }
423 
424     public void setUnsupportedPropertyType( final Math value )
425     {
426         this.unsupportedPropertyType = value;
427     }
428 
429     public InstantiationExceptionPropertyType getInstantiationExceptionProperty()
430     {
431         return this.instantiationExceptionProperty;
432     }
433 
434     public void setInstantiationExceptionProperty( final InstantiationExceptionPropertyType value )
435     {
436         this.instantiationExceptionProperty = value;
437     }
438 
439     public InvocationTargetExceptionPropertyType getInvocationTargetExceptionProperty()
440     {
441         return this.invocationTargetExceptionProperty;
442     }
443 
444     public void setInvocationTargetExceptionProperty( final InvocationTargetExceptionPropertyType value )
445     {
446         this.invocationTargetExceptionProperty = value;
447     }
448 
449 }