| 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, 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: RuntimeModule.java 4881 2014-02-20 22:55:53Z schulte $ | 
| 32 |  * | 
| 33 |  */ | 
| 34 | // </editor-fold> | 
| 35 | // SECTION-END | 
| 36 | package org.jomc.ri.model; | 
| 37 |   | 
| 38 | import org.jomc.model.Module; | 
| 39 |   | 
| 40 | // SECTION-START[Documentation] | 
| 41 | // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> | 
| 42 | /** | 
| 43 |  * Runtime {@code Module}. | 
| 44 |  * | 
| 45 |  * <dl> | 
| 46 |  *   <dt><b>Identifier:</b></dt><dd>org.jomc.ri.model.RuntimeModule</dd> | 
| 47 |  *   <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ RuntimeModule</dd> | 
| 48 |  *   <dt><b>Specifications:</b></dt> | 
| 49 |  *     <dd>org.jomc.ri.model.RuntimeModelObject @ 1.2</dd> | 
| 50 |  *   <dt><b>Abstract:</b></dt><dd>No</dd> | 
| 51 |  *   <dt><b>Final:</b></dt><dd>No</dd> | 
| 52 |  *   <dt><b>Stateless:</b></dt><dd>No</dd> | 
| 53 |  * </dl> | 
| 54 |  * | 
| 55 |  * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.2 | 
| 56 |  * @version 1.2 | 
| 57 |  */ | 
| 58 | // </editor-fold> | 
| 59 | // SECTION-END | 
| 60 | // SECTION-START[Annotations] | 
| 61 | // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> | 
| 62 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6" ) | 
| 63 | // </editor-fold> | 
| 64 | // SECTION-END | 
| 65 | public class RuntimeModule extends Module implements RuntimeModelObject | 
| 66 | { | 
| 67 |     // SECTION-START[RuntimeModule] | 
| 68 |   | 
| 69 |     /** | 
| 70 |      * Creates a new {@code RuntimeModule} instance by deeply copying a given {@code Module} instance. | 
| 71 |      * | 
| 72 |      * @param module The instance to copy. | 
| 73 |      * | 
| 74 |      * @throws NullPointerException if {@code module} is {@code null}. | 
| 75 |      */ | 
| 76 |     public RuntimeModule( final Module module ) | 
| 77 |     { | 
| 78 |         super( module ); | 
| 79 |   | 
| 80 |         if ( this.getAuthors() != null ) | 
| 81 |         { | 
| 82 |             this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) ); | 
| 83 |         } | 
| 84 |         if ( this.getDocumentation() != null ) | 
| 85 |         { | 
| 86 |             this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) ); | 
| 87 |         } | 
| 88 |         if ( this.getImplementations() != null ) | 
| 89 |         { | 
| 90 |             this.setImplementations( RuntimeModelObjects.getInstance().copyOf( this.getImplementations() ) ); | 
| 91 |         } | 
| 92 |         if ( this.getMessages() != null ) | 
| 93 |         { | 
| 94 |             this.setMessages( RuntimeModelObjects.getInstance().copyOf( this.getMessages() ) ); | 
| 95 |         } | 
| 96 |         if ( this.getProperties() != null ) | 
| 97 |         { | 
| 98 |             this.setProperties( RuntimeModelObjects.getInstance().copyOf( this.getProperties() ) ); | 
| 99 |         } | 
| 100 |         if ( this.getSpecifications() != null ) | 
| 101 |         { | 
| 102 |             this.setSpecifications( RuntimeModelObjects.getInstance().copyOf( this.getSpecifications() ) ); | 
| 103 |         } | 
| 104 |     } | 
| 105 |   | 
| 106 |     // SECTION-END | 
| 107 |     // SECTION-START[RuntimeModelObject] | 
| 108 |     public void gc() | 
| 109 |     { | 
| 110 |         this.gcOrClear( true, false ); | 
| 111 |     } | 
| 112 |   | 
| 113 |     public void clear() | 
| 114 |     { | 
| 115 |         this.gcOrClear( false, true ); | 
| 116 |     } | 
| 117 |   | 
| 118 |     private void gcOrClear( final boolean gc, final boolean clear ) | 
| 119 |     { | 
| 120 |         if ( this.getAuthors() instanceof RuntimeModelObject ) | 
| 121 |         { | 
| 122 |             if ( gc ) | 
| 123 |             { | 
| 124 |                 ( (RuntimeModelObject) this.getAuthors() ).gc(); | 
| 125 |             } | 
| 126 |             if ( clear ) | 
| 127 |             { | 
| 128 |                 ( (RuntimeModelObject) this.getAuthors() ).clear(); | 
| 129 |             } | 
| 130 |         } | 
| 131 |         if ( this.getDocumentation() instanceof RuntimeModelObject ) | 
| 132 |         { | 
| 133 |             if ( gc ) | 
| 134 |             { | 
| 135 |                 ( (RuntimeModelObject) this.getDocumentation() ).gc(); | 
| 136 |             } | 
| 137 |             if ( clear ) | 
| 138 |             { | 
| 139 |                 ( (RuntimeModelObject) this.getDocumentation() ).clear(); | 
| 140 |             } | 
| 141 |         } | 
| 142 |         if ( this.getImplementations() instanceof RuntimeModelObject ) | 
| 143 |         { | 
| 144 |             if ( gc ) | 
| 145 |             { | 
| 146 |                 ( (RuntimeModelObject) this.getImplementations() ).gc(); | 
| 147 |             } | 
| 148 |             if ( clear ) | 
| 149 |             { | 
| 150 |                 ( (RuntimeModelObject) this.getImplementations() ).clear(); | 
| 151 |             } | 
| 152 |         } | 
| 153 |         if ( this.getMessages() instanceof RuntimeModelObject ) | 
| 154 |         { | 
| 155 |             if ( gc ) | 
| 156 |             { | 
| 157 |                 ( (RuntimeModelObject) this.getMessages() ).gc(); | 
| 158 |             } | 
| 159 |             if ( clear ) | 
| 160 |             { | 
| 161 |                 ( (RuntimeModelObject) this.getMessages() ).clear(); | 
| 162 |             } | 
| 163 |         } | 
| 164 |         if ( this.getProperties() instanceof RuntimeModelObject ) | 
| 165 |         { | 
| 166 |             if ( gc ) | 
| 167 |             { | 
| 168 |                 ( (RuntimeModelObject) this.getProperties() ).gc(); | 
| 169 |             } | 
| 170 |             if ( clear ) | 
| 171 |             { | 
| 172 |                 ( (RuntimeModelObject) this.getProperties() ).clear(); | 
| 173 |             } | 
| 174 |         } | 
| 175 |         if ( this.getSpecifications() instanceof RuntimeModelObject ) | 
| 176 |         { | 
| 177 |             if ( gc ) | 
| 178 |             { | 
| 179 |                 ( (RuntimeModelObject) this.getSpecifications() ).gc(); | 
| 180 |             } | 
| 181 |             if ( clear ) | 
| 182 |             { | 
| 183 |                 ( (RuntimeModelObject) this.getSpecifications() ).clear(); | 
| 184 |             } | 
| 185 |         } | 
| 186 |     } | 
| 187 |   | 
| 188 |     // SECTION-END | 
| 189 |     // SECTION-START[Constructors] | 
| 190 |     // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> | 
| 191 |     /** Creates a new {@code RuntimeModule} instance. */ | 
| 192 |     @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6" ) | 
| 193 |     public RuntimeModule() | 
| 194 |     { | 
| 195 |         // SECTION-START[Default Constructor] | 
| 196 |         super(); | 
| 197 |         // SECTION-END | 
| 198 |     } | 
| 199 |     // </editor-fold> | 
| 200 |     // SECTION-END | 
| 201 |     // SECTION-START[Dependencies] | 
| 202 |     // SECTION-END | 
| 203 |     // SECTION-START[Properties] | 
| 204 |     // SECTION-END | 
| 205 |     // SECTION-START[Messages] | 
| 206 |     // SECTION-END | 
| 207 | } |