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: RuntimeImplementationReference.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 org.jomc.model.ImplementationReference; 39 40 // SECTION-START[Documentation] 41 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 42 /** 43 * Runtime {@code ImplementationReference}. 44 * 45 * <dl> 46 * <dt><b>Identifier:</b></dt><dd>org.jomc.ri.model.RuntimeImplementationReference</dd> 47 * <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ RuntimeImplementationReference</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.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" ) 63 // </editor-fold> 64 // SECTION-END 65 public class RuntimeImplementationReference extends ImplementationReference implements RuntimeModelObject 66 { 67 // SECTION-START[RuntimeImplementationReference] 68 69 /** 70 * Creates a new {@code RuntimeImplementationReference} instance by deeply copying a given 71 * {@code ImplementationReference} instance. 72 * 73 * @param reference The instance to copy. 74 * 75 * @throws NullPointerException if {@code reference} is {@code null}. 76 */ 77 public RuntimeImplementationReference( final ImplementationReference reference ) 78 { 79 super( reference ); 80 81 if ( this.getAuthors() != null ) 82 { 83 this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) ); 84 } 85 if ( this.getDocumentation() != null ) 86 { 87 this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) ); 88 } 89 } 90 91 // SECTION-END 92 // SECTION-START[RuntimeModelObject] 93 public void gc() 94 { 95 this.gcOrClear( true, false ); 96 } 97 98 public void clear() 99 { 100 this.gcOrClear( false, true ); 101 } 102 103 private void gcOrClear( final boolean gc, final boolean clear ) 104 { 105 if ( this.getAuthors() instanceof RuntimeModelObject ) 106 { 107 if ( gc ) 108 { 109 ( (RuntimeModelObject) this.getAuthors() ).gc(); 110 } 111 if ( clear ) 112 { 113 ( (RuntimeModelObject) this.getAuthors() ).clear(); 114 } 115 } 116 if ( this.getDocumentation() instanceof RuntimeModelObject ) 117 { 118 if ( gc ) 119 { 120 ( (RuntimeModelObject) this.getDocumentation() ).gc(); 121 } 122 if ( clear ) 123 { 124 ( (RuntimeModelObject) this.getDocumentation() ).clear(); 125 } 126 } 127 } 128 129 // SECTION-END 130 // SECTION-START[Constructors] 131 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 132 /** Creates a new {@code RuntimeImplementationReference} instance. */ 133 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.9", comments = "See http://www.jomc.org/jomc/1.9/jomc-tools-1.9" ) 134 public RuntimeImplementationReference() 135 { 136 // SECTION-START[Default Constructor] 137 super(); 138 // SECTION-END 139 } 140 // </editor-fold> 141 // SECTION-END 142 // SECTION-START[Dependencies] 143 // SECTION-END 144 // SECTION-START[Properties] 145 // SECTION-END 146 // SECTION-START[Messages] 147 // SECTION-END 148 149 }