EMMA Coverage Report (generated Thu Jan 03 04:54:40 CET 2013)
[all classes][org.jomc.ri.model]

COVERAGE SUMMARY FOR SOURCE FILE [RuntimeArgument.java]

nameclass, %method, %block, %line, %
RuntimeArgument.java100% (1/1)50%  (3/6)33%  (27/81)37%  (10/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RuntimeArgument100% (1/1)50%  (3/6)33%  (27/81)37%  (10/27)
RuntimeArgument (): void 0%   (0/1)0%   (0/3)0%   (0/2)
gc (): void 0%   (0/1)0%   (0/5)0%   (0/2)
getJavaTypeName (): JavaTypeName 0%   (0/1)0%   (0/10)0%   (0/3)
gcOrClear (boolean, boolean): void 100% (1/1)27%  (9/33)27%  (3/11)
RuntimeArgument (Argument): void 100% (1/1)45%  (10/22)67%  (4/6)
clear (): void 100% (1/1)100% (8/8)100% (3/3)

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: RuntimeArgument.java 4712 2013-01-02 13:56:12Z schulte $
32 *
33 */
34// </editor-fold>
35// SECTION-END
36package org.jomc.ri.model;
37 
38import javax.xml.bind.annotation.XmlTransient;
39import org.jomc.model.Argument;
40import org.jomc.model.ArgumentType;
41import org.jomc.model.JavaTypeName;
42import org.jomc.model.ModelObjectException;
43 
44// SECTION-START[Documentation]
45// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
46/**
47 * Runtime {@code Argument}.
48 *
49 * <dl>
50 *   <dt><b>Identifier:</b></dt><dd>org.jomc.ri.model.RuntimeArgument</dd>
51 *   <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ RuntimeArgument</dd>
52 *   <dt><b>Specifications:</b></dt>
53 *     <dd>org.jomc.ri.model.RuntimeModelObject @ 1.2</dd>
54 *   <dt><b>Abstract:</b></dt><dd>No</dd>
55 *   <dt><b>Final:</b></dt><dd>No</dd>
56 *   <dt><b>Stateless:</b></dt><dd>No</dd>
57 * </dl>
58 *
59 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.2
60 * @version 1.2
61 */
62// </editor-fold>
63// SECTION-END
64// SECTION-START[Annotations]
65// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
66@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
67// </editor-fold>
68// SECTION-END
69public class RuntimeArgument extends Argument implements RuntimeModelObject
70{
71    // SECTION-START[RuntimeArgument]
72 
73    /** Java type name. */
74    @XmlTransient
75    private volatile JavaTypeName javaTypeName;
76 
77    /**
78     * Creates a new {@code RuntimeArgument} instance by deeply copying a given {@code Argument} instance.
79     *
80     * @param argument The instance to copy.
81     *
82     * @throws NullPointerException if {@code argument} is {@code null}.
83     */
84    public RuntimeArgument( final Argument argument )
85    {
86        super( argument );
87 
88        if ( this.getAuthors() != null )
89        {
90            this.setAuthors( RuntimeModelObjects.getInstance().copyOf( this.getAuthors() ) );
91        }
92        if ( this.getDocumentation() != null )
93        {
94            this.setDocumentation( RuntimeModelObjects.getInstance().copyOf( this.getDocumentation() ) );
95        }
96    }
97 
98    /**
99     * Gets the Java type name of the type referenced by the argument.
100     * <p>This method queries an internal cache for a result object to return. If no cached result object is available,
101     * this method queries the super-class for a result object to return and caches the outcome of that query for use on
102     * successive calls.</p>
103     * <p><b>Note:</b><br/>Method {@code clear()} must be used to synchronize the state of the internal cache with the
104     * state of the instance, should the state of the instance change.</p>
105     *
106     * @return The Java type name of the type referenced by the argument or {@code null}, if the argument does not
107     * reference a type.
108     *
109     * @throws ModelObjectException if compiling the name of the referenced type to a {@code JavaTypeName} fails.
110     *
111     * @since 1.4
112     *
113     * @see #getType()
114     * @see #clear()
115     */
116    @Override
117    public JavaTypeName getJavaTypeName() throws ModelObjectException
118    {
119        if ( this.javaTypeName == null )
120        {
121            this.javaTypeName = super.getJavaTypeName();
122        }
123 
124        return this.javaTypeName;
125    }
126 
127    // SECTION-END
128    // SECTION-START[RuntimeModelObject]
129    public void gc()
130    {
131        this.gcOrClear( true, false );
132    }
133 
134    public void clear()
135    {
136        this.javaTypeName = null;
137        this.gcOrClear( false, true );
138    }
139 
140    private void gcOrClear( final boolean gc, final boolean clear )
141    {
142        if ( this.getAuthors() instanceof RuntimeModelObject )
143        {
144            if ( gc )
145            {
146                ( (RuntimeModelObject) this.getAuthors() ).gc();
147            }
148            if ( clear )
149            {
150                ( (RuntimeModelObject) this.getAuthors() ).clear();
151            }
152        }
153        if ( this.getDocumentation() instanceof RuntimeModelObject )
154        {
155            if ( gc )
156            {
157                ( (RuntimeModelObject) this.getDocumentation() ).gc();
158            }
159            if ( clear )
160            {
161                ( (RuntimeModelObject) this.getDocumentation() ).clear();
162            }
163        }
164    }
165 
166    // SECTION-END
167    // SECTION-START[Constructors]
168    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
169    /** Creates a new {@code RuntimeArgument} instance. */
170    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
171    public RuntimeArgument()
172    {
173        // SECTION-START[Default Constructor]
174        super();
175        // SECTION-END
176    }
177    // </editor-fold>
178    // SECTION-END
179    // SECTION-START[Dependencies]
180    // SECTION-END
181    // SECTION-START[Properties]
182    // SECTION-END
183    // SECTION-START[Messages]
184    // SECTION-END
185}

[all classes][org.jomc.ri.model]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov