1 // SECTION-START[License Header]
2 // <editor-fold defaultstate="collapsed" desc=" Generated License ">
3 /*
4 * Java Object Management and Configuration
5 * Copyright (C) Christian Schulte <cs@schulte.it>, 2011-313
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * o Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * o Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $JOMC: RuntimeInstance.java 5061 2015-05-31 13:20:40Z schulte $
32 *
33 */
34 // </editor-fold>
35 // SECTION-END
36 package org.jomc.ri.model;
37
38 import java.lang.ref.Reference;
39 import java.lang.ref.WeakReference;
40 import java.lang.reflect.Constructor;
41 import java.lang.reflect.Method;
42 import java.util.Map;
43 import javax.xml.bind.annotation.XmlTransient;
44 import org.jomc.model.Instance;
45 import org.jomc.model.JavaTypeName;
46 import org.jomc.model.ModelObjectException;
47 import org.jomc.model.Specification;
48 import org.jomc.util.WeakIdentityHashMap;
49 import static org.jomc.ri.model.RuntimeModelObjects.BOOTSTRAP_CLASSLOADER_KEY;
50 import static org.jomc.ri.model.RuntimeModelObjects.classesByClassLoaderAndNameCache;
51 import static org.jomc.ri.model.RuntimeModelObjects.createMap;
52
53 // SECTION-START[Documentation]
54 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
55 /**
56 * Runtime {@code Instance}.
57 *
58 * <dl>
59 * <dt><b>Identifier:</b></dt><dd>org.jomc.ri.model.RuntimeInstance</dd>
60 * <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ RuntimeInstance</dd>
61 * <dt><b>Specifications:</b></dt>
62 * <dd>org.jomc.ri.model.RuntimeModelObject @ 1.2</dd>
63 * <dt><b>Abstract:</b></dt><dd>No</dd>
64 * <dt><b>Final:</b></dt><dd>No</dd>
65 * <dt><b>Stateless:</b></dt><dd>No</dd>
66 * </dl>
67 *
68 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.2
69 * @version 1.2
70 */
71 // </editor-fold>
72 // SECTION-END
73 // SECTION-START[Annotations]
74 // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
75 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
76 // </editor-fold>
77 // SECTION-END
78 public class RuntimeInstance extends Instance implements RuntimeModelObject
79 {
80 // SECTION-START[RuntimeInstance]
81
82 /**
83 * Classes by class loader any instance cache.
84 */
85 @XmlTransient
86 static final Map<ClassLoader, Map<String, Reference<Class<?>[]>>> classesByClassLoaderAndInstanceCache =
87 new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Class<?>[]>>>();
88
89 /**
90 * Constructors by class loader any instance cache.
91 */
92 @XmlTransient
93 static final Map<ClassLoader, Map<String, Reference<Constructor<?>>>> constructorsByClassLoaderAndInstanceCache =
94 new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Constructor<?>>>>();
95
96 /**
97 * Methods by class loader any instance cache.
98 */
99 @XmlTransient
100 static final Map<ClassLoader, Map<String, Reference<Method>>> methodsByClassLoaderAndInstanceCache =
101 new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Method>>>();
102
103 /**
104 * Assignable flags by class loader any instance cache.
105 */
106 @XmlTransient
107 static final Map<ClassLoader, Map<String, Boolean>> assignableFlagsByClassLoaderAndInstanceCache =
108 new WeakIdentityHashMap<ClassLoader, Map<String, Boolean>>();
109
110 /**
111 * Proxy classes by class loader any instance cache.
112 */
113 @XmlTransient
114 static final Map<ClassLoader, Map<String, Reference<Class<?>>>> proxyClassesByClassLoaderAndInstanceCache =
115 new WeakIdentityHashMap<ClassLoader, Map<String, Reference<Class<?>>>>();
116
117 /**
118 * Method name.
119 */
120 @XmlTransient
121 private volatile String javaClassFactoryMethodName;
122
123 /**
124 * Java type name.
125 */
126 @XmlTransient
127 private volatile JavaTypeName javaTypeName;
128
129 /**
130 * Creates a new {@code RuntimeInstance} instance by deeply copying a given {@code Instance} instance.
131 *
132 * @param instance The instance to copy.
133 *
134 * @throws NullPointerException if {@code instance} is {@code null}.
135 */
136 public RuntimeInstance( final Instance instance )
137 {
138 super( instance );
139
140 if ( this.getAuthors() != null )
141 {
142 this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) );
143 }
144 if ( this.getDependencies() != null )
145 {
146 this.setDependencies( RuntimeModelObjects.getInstance().copyOf( this.getDependencies() ) );
147 }
148 if ( this.getDocumentation() != null )
149 {
150 this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) );
151 }
152 if ( this.getMessages() != null )
153 {
154 this.setMessages( RuntimeModelObjects.getInstance().copyOf( this.getMessages() ) );
155 }
156 if ( this.getProperties() != null )
157 {
158 this.setProperties( RuntimeModelObjects.getInstance().copyOf( this.getProperties() ) );
159 }
160 if ( this.getSpecifications() != null )
161 {
162 this.setSpecifications( RuntimeModelObjects.getInstance().copyOf( this.getSpecifications() ) );
163 }
164 }
165
166 /**
167 * Gets the Java class of the instance for a given class loader.
168 * <p>
169 * This method queries an internal cache for a result object to return for the given argument values. If no
170 * cached result object is available, this method queries the super-class for a result object to return and caches
171 * the outcome of that query for use on successive calls.
172 * </p>
173 * <p>
174 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
175 * internal cache with the state of the class loader, should the state of the class loader change.
176 * </p>
177 *
178 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
179 * platform's bootstrap class loader.
180 *
181 * @return The Java class of the instance.
182 *
183 * @throws ClassNotFoundException if the Java class is not found.
184 * @throws ModelObjectException if parsing the name of the referenced type fails.
185 *
186 * @see #getClazz()
187 * @see RuntimeModelObjects#clear()
188 */
189 @Override
190 public Class<?> getJavaClass( final ClassLoader classLoader )
191 throws ModelObjectException, ClassNotFoundException
192 {
193 Class<?> javaClass = null;
194
195 if ( this.getJavaTypeName() != null )
196 {
197 ClassLoader classLoaderKey = classLoader;
198 if ( classLoaderKey == null )
199 {
200 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
201 }
202
203 synchronized ( classesByClassLoaderAndNameCache )
204 {
205 Map<String, Reference<Class<?>>> map = classesByClassLoaderAndNameCache.get( classLoaderKey );
206
207 if ( map == null )
208 {
209 map = createMap();
210 classesByClassLoaderAndNameCache.put( classLoaderKey, map );
211 }
212
213 final Reference<Class<?>> reference = map.get( this.getJavaTypeName().getClassName() );
214
215 if ( reference != null )
216 {
217 javaClass = reference.get();
218 }
219
220 if ( javaClass == null )
221 {
222 javaClass = super.getJavaClass( classLoader );
223 map.put( this.getJavaTypeName().getClassName(), new WeakReference<Class<?>>( javaClass ) );
224 }
225 }
226 }
227
228 return javaClass;
229 }
230
231 /**
232 * Gets the Java classes of all specifications of the instance for a given class loader.
233 * <p>
234 * This method queries an internal cache for a result object to return for the given argument values. If no
235 * cached result object is available, this method queries the super-class for a result object to return and caches
236 * the outcome of that query for use on successive calls.
237 * </p>
238 * <p>
239 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
240 * internal cache with the state of the instance and class loader, should the state of the instance or class loader
241 * change.
242 * </p>
243 *
244 * @param classLoader The class loader to get the Java classes from or {@code null}, to get the Java classes from
245 * the platform's bootstrap class loader.
246 *
247 * @return The Java classes of all specifications of the instance.
248 *
249 * @throws ClassNotFoundException if a Java class is not found.
250 * @throws ModelObjectException if parsing a name of a referenced type fails.
251 *
252 * @see #getSpecifications()
253 * @see Specification#getClazz()
254 * @see RuntimeModelObjects#clear()
255 */
256 @Override
257 public Class<?>[] getJavaClasses( final ClassLoader classLoader )
258 throws ModelObjectException, ClassNotFoundException
259 {
260 ClassLoader classLoaderKey = classLoader;
261 if ( classLoaderKey == null )
262 {
263 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
264 }
265
266 synchronized ( classesByClassLoaderAndInstanceCache )
267 {
268 Class<?>[] javaClasses = null;
269 Map<String, Reference<Class<?>[]>> map = classesByClassLoaderAndInstanceCache.get( classLoaderKey );
270
271 if ( map == null )
272 {
273 map = createMap();
274 classesByClassLoaderAndInstanceCache.put( classLoaderKey, map );
275 }
276
277 final Reference<Class<?>[]> reference = map.get( this.getIdentifier() );
278
279 if ( reference != null )
280 {
281 javaClasses = reference.get();
282 }
283
284 if ( javaClasses == null && ( reference != null || !map.containsKey( this.getIdentifier() ) ) )
285 {
286 javaClasses = super.getJavaClasses( classLoader );
287 map.put( this.getIdentifier(), new WeakReference<Class<?>[]>( javaClasses ) );
288 }
289
290 return javaClasses;
291 }
292 }
293
294 /**
295 * Gets the Java constructor to use for creating objects of the instance.
296 * <p>
297 * This method queries an internal cache for a result object to return for the given argument values. If no
298 * cached result object is available, this method queries the super-class for a result object to return and caches
299 * the outcome of that query for use on successive calls.
300 * </p>
301 * <p>
302 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
303 * internal cache with the state of the instance and class loader, should the state of the instance or class loader
304 * change.
305 * </p>
306 *
307 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
308 * platform's bootstrap class loader.
309 *
310 * @return The public default Java constructor of the Java class of the instance or {@code null}, if that class
311 * does not declare such a constructor, is abstract or is not public.
312 *
313 * @throws ClassNotFoundException if the Java class is not found.
314 * @throws ModelObjectException if parsing the name of the type referenced by the instance fails.
315 *
316 * @see #getJavaClass(java.lang.ClassLoader)
317 * @see RuntimeModelObjects#clear()
318 */
319 @Override
320 public Constructor<?> getJavaConstructor( final ClassLoader classLoader )
321 throws ModelObjectException, ClassNotFoundException
322 {
323 ClassLoader classLoaderKey = classLoader;
324 if ( classLoaderKey == null )
325 {
326 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
327 }
328
329 synchronized ( constructorsByClassLoaderAndInstanceCache )
330 {
331 Constructor<?> javaClassConstructor = null;
332 Map<String, Reference<Constructor<?>>> map = constructorsByClassLoaderAndInstanceCache.get( classLoaderKey );
333
334 if ( map == null )
335 {
336 map = createMap();
337 constructorsByClassLoaderAndInstanceCache.put( classLoaderKey, map );
338 }
339
340 final Reference<Constructor<?>> reference = map.get( this.getIdentifier() );
341
342 if ( reference != null )
343 {
344 javaClassConstructor = reference.get();
345 }
346
347 if ( javaClassConstructor == null && ( reference != null || !map.containsKey( this.getIdentifier() ) ) )
348 {
349 javaClassConstructor = super.getJavaConstructor( classLoader );
350 map.put( this.getIdentifier(), new WeakReference<Constructor<?>>( javaClassConstructor ) );
351 }
352
353 return javaClassConstructor;
354 }
355 }
356
357 /**
358 * Gets the name of the Java method to use for creating objects of the instance.
359 * <p>
360 * This method queries an internal cache for a result object to return. If no cached result object is available,
361 * this method queries the super-class for a result object to return and caches the outcome of that query for use on
362 * successive calls.
363 * </p>
364 * <p>
365 * <b>Note:</b><br/>Method {@code clear()} must be used to synchronize the state of the internal cache with the
366 * state of the instance, should the state of the instance change.
367 * </p>
368 *
369 * @return The name of the Java method to use for creating objects of the instance or {@code null}, if no such
370 * method name is supported.
371 *
372 * @throws ModelObjectException if compiling the name of the instance to a {@code JavaIdentifier} fails.
373 *
374 * @see #getName()
375 * @see #clear()
376 */
377 @Override
378 public String getJavaFactoryMethodName() throws ModelObjectException
379 {
380 if ( this.javaClassFactoryMethodName == null )
381 {
382 this.javaClassFactoryMethodName = super.getJavaFactoryMethodName();
383 }
384
385 return this.javaClassFactoryMethodName;
386 }
387
388 /**
389 * Gets the Java method to use for creating objects of the instance.
390 * <p>
391 * This method queries an internal cache for a result object to return for the given argument values. If no
392 * cached result object is available, this method queries the super-class for a result object to return and caches
393 * the outcome of that query for use on successive calls.
394 * </p>
395 * <p>
396 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
397 * internal cache with the state of the instance and class loader, should the state of the instance or class loader
398 * change.
399 * </p>
400 *
401 * @param classLoader The class loader to get the Java class from or {@code null}, to get the Java class from the
402 * platform's bootstrap class loader.
403 *
404 * @return The public Java method of the Java class of the instance to use for creating objects of the instance or
405 * {@code null}, if that class does not declare such a method.
406 *
407 * @throws ClassNotFoundException if the Java class is not found.
408 * @throws ModelObjectException if parsing the name of the type referenced by the instance fails.
409 *
410 * @see #getJavaClass(java.lang.ClassLoader)
411 * @see #getJavaFactoryMethodName()
412 * @see RuntimeModelObjects#clear()
413 */
414 @Override
415 public Method getJavaFactoryMethod( final ClassLoader classLoader )
416 throws ModelObjectException, ClassNotFoundException
417 {
418 ClassLoader classLoaderKey = classLoader;
419 if ( classLoaderKey == null )
420 {
421 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
422 }
423
424 synchronized ( methodsByClassLoaderAndInstanceCache )
425 {
426 Method javaClassFactoryMethod = null;
427 Map<String, Reference<Method>> map = methodsByClassLoaderAndInstanceCache.get( classLoaderKey );
428
429 if ( map == null )
430 {
431 map = createMap();
432 methodsByClassLoaderAndInstanceCache.put( classLoaderKey, map );
433 }
434
435 final Reference<Method> reference = map.get( this.getIdentifier() );
436
437 if ( reference != null )
438 {
439 javaClassFactoryMethod = reference.get();
440 }
441
442 if ( javaClassFactoryMethod == null && ( reference != null || !map.containsKey( this.getIdentifier() ) ) )
443 {
444 javaClassFactoryMethod = super.getJavaFactoryMethod( classLoader );
445 map.put( this.getIdentifier(), new WeakReference<Method>( javaClassFactoryMethod ) );
446 }
447
448 return javaClassFactoryMethod;
449 }
450 }
451
452 /**
453 * Gets a flag indicating the Java class of the instance is assignable to all Java classes of all specifications of
454 * the instance.
455 * <p>
456 * This method queries an internal cache for a result object to return for the given argument values. If no
457 * cached result object is available, this method queries the super-class for a result object to return and caches
458 * the outcome of that query for use on successive calls.
459 * </p>
460 * <p>
461 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
462 * internal cache with the state of the instance and class loader, should the state of the instance or class loader
463 * change.
464 * </p>
465 *
466 * @param classLoader The class loader to get the Java classes from or {@code null}, to get the Java classes from
467 * the platform's bootstrap class loader.
468 *
469 * @return {@code true}, if the Java class of the instance is assignable to all Java classes of all specifications
470 * of the instance; {@code false}, if the Java class of the instance is not assignable to all Java classes of all
471 * specifications of the instance.
472 *
473 * @throws ClassNotFoundException if a Java class is not found.
474 * @throws ModelObjectException if parsing a name of a referenced type fails.
475 *
476 * @see #getJavaClass(java.lang.ClassLoader)
477 * @see #getJavaClasses(java.lang.ClassLoader)
478 * @see RuntimeModelObjects#clear()
479 */
480 @Override
481 public boolean isJavaClassAssignable( final ClassLoader classLoader )
482 throws ModelObjectException, ClassNotFoundException
483 {
484 ClassLoader classLoaderKey = classLoader;
485 if ( classLoaderKey == null )
486 {
487 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
488 }
489
490 synchronized ( assignableFlagsByClassLoaderAndInstanceCache )
491 {
492 Map<String, Boolean> map = assignableFlagsByClassLoaderAndInstanceCache.get( classLoaderKey );
493
494 if ( map == null )
495 {
496 map = createMap();
497 assignableFlagsByClassLoaderAndInstanceCache.put( classLoaderKey, map );
498 }
499
500 Boolean javaClassAssignable = map.get( this.getIdentifier() );
501
502 if ( javaClassAssignable == null && !map.containsKey( this.getIdentifier() ) )
503 {
504 javaClassAssignable = super.isJavaClassAssignable( classLoader );
505 map.put( this.getIdentifier(), javaClassAssignable );
506 }
507
508 return javaClassAssignable == null ? false : javaClassAssignable;
509 }
510 }
511
512 /**
513 * Gets the Java proxy class for a given class loader.
514 * <p>
515 * This method queries an internal cache for a result object to return for the given argument values. If no
516 * cached result object is available, this method queries the super-class for a result object to return and caches
517 * the outcome of that query for use on successive calls.
518 * </p>
519 * <p>
520 * <b>Note:</b><br/>Method {@code RuntimeModelObjects.clear()} must be used to synchronize the state of the
521 * internal cache with the state of the instance and class loader, should the state of the instance or class loader
522 * change.
523 * </p>
524 *
525 * @param classLoader The class loader to get the Java proxy class for.
526 *
527 * @return The Java proxy class for {@code classLoader} or {@code null}, if the instance does not support a Java
528 * proxy class.
529 *
530 * @throws ClassNotFoundException if a Java class is not found.
531 * @throws ModelObjectException if parsing a name of a referenced type fails.
532 *
533 * @see #getJavaClasses(java.lang.ClassLoader)
534 * @see RuntimeModelObjects#clear()
535 */
536 @Override
537 public Class<?> getJavaProxyClass( final ClassLoader classLoader )
538 throws ModelObjectException, ClassNotFoundException
539 {
540 ClassLoader classLoaderKey = classLoader;
541 if ( classLoaderKey == null )
542 {
543 classLoaderKey = BOOTSTRAP_CLASSLOADER_KEY;
544 }
545
546 synchronized ( proxyClassesByClassLoaderAndInstanceCache )
547 {
548 Class<?> javaProxyClass = null;
549 Map<String, Reference<Class<?>>> map = proxyClassesByClassLoaderAndInstanceCache.get( classLoaderKey );
550
551 if ( map == null )
552 {
553 map = createMap();
554 proxyClassesByClassLoaderAndInstanceCache.put( classLoaderKey, map );
555 }
556
557 final Reference<Class<?>> reference = map.get( this.getIdentifier() );
558
559 if ( reference != null )
560 {
561 javaProxyClass = reference.get();
562 }
563
564 if ( javaProxyClass == null && ( reference != null || !map.containsKey( this.getIdentifier() ) ) )
565 {
566 javaProxyClass = super.getJavaProxyClass( classLoader );
567 map.put( this.getIdentifier(), new WeakReference<Class<?>>( javaProxyClass ) );
568 }
569
570 return javaProxyClass;
571 }
572 }
573
574 /**
575 * Gets the Java type name of the type referenced by the instance.
576 * <p>
577 * This method queries an internal cache for a result object to return. If no cached result object is available,
578 * this method queries the super-class for a result object to return and caches the outcome of that query for use on
579 * successive calls.
580 * </p>
581 * <p>
582 * <b>Note:</b><br/>Method {@code clear()} must be used to synchronize the state of the internal cache with the
583 * state of the instance, should the state of the instance change.
584 * </p>
585 *
586 * @return The Java type name of the type referenced by the instance or {@code null}, if the instance does not
587 * reference a type.
588 *
589 * @throws ModelObjectException if compiling the name of the referenced type to a {@code JavaTypeName} fails.
590 *
591 * @since 1.4
592 *
593 * @see Instance#getJavaTypeName()
594 * @see #clear()
595 */
596 @Override
597 public JavaTypeName getJavaTypeName() throws ModelObjectException
598 {
599 if ( this.javaTypeName == null )
600 {
601 this.javaTypeName = super.getJavaTypeName();
602 }
603
604 return this.javaTypeName;
605 }
606
607 // SECTION-END
608 // SECTION-START[RuntimeModelObject]
609 public void gc()
610 {
611 this.gcOrClear( true, false );
612 }
613
614 public void clear()
615 {
616 this.javaClassFactoryMethodName = null;
617 this.javaTypeName = null;
618 this.gcOrClear( false, true );
619 }
620
621 private void gcOrClear( final boolean gc, final boolean clear )
622 {
623 if ( this.getAuthors() instanceof RuntimeModelObject )
624 {
625 if ( gc )
626 {
627 ( (RuntimeModelObject) this.getAuthors() ).gc();
628 }
629 if ( clear )
630 {
631 ( (RuntimeModelObject) this.getAuthors() ).clear();
632 }
633 }
634 if ( this.getDependencies() instanceof RuntimeModelObject )
635 {
636 if ( gc )
637 {
638 ( (RuntimeModelObject) this.getDependencies() ).gc();
639 }
640 if ( clear )
641 {
642 ( (RuntimeModelObject) this.getDependencies() ).clear();
643 }
644 }
645 if ( this.getDocumentation() instanceof RuntimeModelObject )
646 {
647 if ( gc )
648 {
649 ( (RuntimeModelObject) this.getDocumentation() ).gc();
650 }
651 if ( clear )
652 {
653 ( (RuntimeModelObject) this.getDocumentation() ).clear();
654 }
655 }
656 if ( this.getMessages() instanceof RuntimeModelObject )
657 {
658 if ( gc )
659 {
660 ( (RuntimeModelObject) this.getMessages() ).gc();
661 }
662 if ( clear )
663 {
664 ( (RuntimeModelObject) this.getMessages() ).clear();
665 }
666 }
667 if ( this.getProperties() instanceof RuntimeModelObject )
668 {
669 if ( gc )
670 {
671 ( (RuntimeModelObject) this.getProperties() ).gc();
672 }
673 if ( clear )
674 {
675 ( (RuntimeModelObject) this.getProperties() ).clear();
676 }
677 }
678 if ( this.getSpecifications() instanceof RuntimeModelObject )
679 {
680 if ( gc )
681 {
682 ( (RuntimeModelObject) this.getSpecifications() ).gc();
683 }
684 if ( clear )
685 {
686 ( (RuntimeModelObject) this.getSpecifications() ).clear();
687 }
688 }
689 }
690
691 // SECTION-END
692 // SECTION-START[Constructors]
693 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
694 /** Creates a new {@code RuntimeInstance} instance. */
695 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" )
696 public RuntimeInstance()
697 {
698 // SECTION-START[Default Constructor]
699 super();
700 // SECTION-END
701 }
702 // </editor-fold>
703 // SECTION-END
704 // SECTION-START[Dependencies]
705 // SECTION-END
706 // SECTION-START[Properties]
707 // SECTION-END
708 // SECTION-START[Messages]
709 // SECTION-END
710
711 }