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

COVERAGE SUMMARY FOR SOURCE FILE [DefaultInvocation.java]

nameclass, %method, %block, %line, %
DefaultInvocation.java100% (1/1)64%  (7/11)65%  (52/80)68%  (13/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultInvocation100% (1/1)64%  (7/11)65%  (52/80)68%  (13/19)
DefaultInvocation (Invocation): void 0%   (0/1)0%   (0/10)0%   (0/3)
getClassLoader (): ClassLoader 0%   (0/1)0%   (0/6)0%   (0/1)
getInstance (): Instance 0%   (0/1)0%   (0/6)0%   (0/1)
getModules (): Modules 0%   (0/1)0%   (0/6)0%   (0/1)
DefaultInvocation (): void 100% (1/1)100% (3/3)100% (2/2)
getArguments (): Object [] 100% (1/1)100% (7/7)100% (1/1)
getContext (): Map 100% (1/1)100% (11/11)100% (3/3)
getMethod (): Method 100% (1/1)100% (6/6)100% (1/1)
getObject (): Object 100% (1/1)100% (5/5)100% (1/1)
getResult (): Object 100% (1/1)100% (5/5)100% (1/1)
setResult (Object): void 100% (1/1)100% (15/15)100% (4/4)

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, 2005-206
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: DefaultInvocation.java 4712 2013-01-02 13:56:12Z schulte $
32 *
33 */
34// </editor-fold>
35// SECTION-END
36package org.jomc.ri;
37 
38import java.lang.reflect.Method;
39import java.util.HashMap;
40import java.util.Map;
41import org.jomc.model.Instance;
42import org.jomc.model.Modules;
43import org.jomc.spi.Invocation;
44 
45// SECTION-START[Documentation]
46// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
47/**
48 * Default {@code Invocation} implementation.
49 *
50 * <dl>
51 *   <dt><b>Identifier:</b></dt><dd>org.jomc.ri.DefaultInvocation</dd>
52 *   <dt><b>Name:</b></dt><dd>JOMC ⁑ RI ⁑ DefaultInvocation</dd>
53 *   <dt><b>Abstract:</b></dt><dd>No</dd>
54 *   <dt><b>Final:</b></dt><dd>No</dd>
55 *   <dt><b>Stateless:</b></dt><dd>No</dd>
56 * </dl>
57 *
58 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
59 * @version 1.0
60 */
61// </editor-fold>
62// SECTION-END
63// SECTION-START[Annotations]
64// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
65@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
66// </editor-fold>
67// SECTION-END
68public class DefaultInvocation implements Invocation
69{
70    // SECTION-START[DefaultInvocation]
71 
72    /** Constant for the context key of the {@code Object} of this invocation. */
73    public static final String OBJECT_KEY = "org.jomc.spi.Invocation.object";
74 
75    /** Constant for the context key of the {@code Method} of this invocation. */
76    public static final String METHOD_KEY = "org.jomc.spi.Invocation.method";
77 
78    /** Constant for the context key of the {@code Object[]} arguments of this invocation. */
79    public static final String ARGUMENTS_KEY = "org.jomc.spi.Invocation.arguments";
80 
81    /** Constant for the context key of the result {@code Object} of this invocation. */
82    public static final String RESULT_KEY = "org.jomc.spi.Invocation.result";
83 
84    /** Constant for the context key of the {@code Instance} corresponding to the object of this invocation. */
85    public static final String INSTANCE_KEY = "org.jomc.spi.Invocation.instance";
86 
87    /** Constant for the context key of the {@code Modules} corresponding to the object of this invocation. */
88    public static final String MODULES_KEY = "org.jomc.spi.Invocation.modules";
89 
90    /** Constant for the context key of the {@code ClassLoader} corresponding to the modules of this invocation. */
91    public static final String CLASSLOADER_KEY = "org.jomc.spi.Invocation.classLoader";
92 
93    /** The context of this invocation. */
94    private Map context;
95 
96    /**
97     * Creates a new {@code DefaultInvocation} instance taking an invocation to initialize the instance with.
98     *
99     * @param invocation The invocation to initialize the instance with.
100     */
101    public DefaultInvocation( final Invocation invocation )
102    {
103        this.context = new HashMap( invocation.getContext() );
104    }
105 
106    public Map getContext()
107    {
108        if ( this.context == null )
109        {
110            this.context = new HashMap();
111        }
112 
113        return this.context;
114    }
115 
116    public Object getObject()
117    {
118        return this.getContext().get( OBJECT_KEY );
119    }
120 
121    public Method getMethod()
122    {
123        return (Method) this.getContext().get( METHOD_KEY );
124    }
125 
126    public Object[] getArguments()
127    {
128        return (Object[]) this.getContext().get( ARGUMENTS_KEY );
129    }
130 
131    public Object getResult()
132    {
133        return this.getContext().get( RESULT_KEY );
134    }
135 
136    public void setResult( final Object value )
137    {
138        if ( value == null )
139        {
140            this.getContext().remove( RESULT_KEY );
141        }
142        else
143        {
144            this.getContext().put( RESULT_KEY, value );
145        }
146    }
147 
148    /**
149     * Gets the instance of the object of this invocation from the context of this invocation.
150     *
151     * @return The instance of the object of this invocation from the context of this invocation or {@code null}.
152     *
153     * @see #INSTANCE_KEY
154     */
155    public Instance getInstance()
156    {
157        return (Instance) this.getContext().get( INSTANCE_KEY );
158    }
159 
160    /**
161     * Gets the modules corresponding to the object of this invocation from the context of this invocation.
162     *
163     * @return The modules corresponding to the object of this invocation from the context of this invocation or
164     * {@code null}.
165     *
166     * @see #MODULES_KEY
167     */
168    public Modules getModules()
169    {
170        return (Modules) this.getContext().get( MODULES_KEY );
171    }
172 
173    /**
174     * Gets the class loader corresponding to the modules of this invocation from the context of this invocation.
175     *
176     * @return The class loader corresponding to the modules of this invocation from the context of this invocation or
177     * {@code null}.
178     *
179     * @see #CLASSLOADER_KEY
180     */
181    public ClassLoader getClassLoader()
182    {
183        return (ClassLoader) this.getContext().get( CLASSLOADER_KEY );
184    }
185 
186    // SECTION-END
187    // SECTION-START[Constructors]
188    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
189    /** Creates a new {@code DefaultInvocation} instance. */
190    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" )
191    public DefaultInvocation()
192    {
193        // SECTION-START[Default Constructor]
194        super();
195        // SECTION-END
196    }
197    // </editor-fold>
198    // SECTION-END
199    // SECTION-START[Dependencies]
200    // SECTION-END
201    // SECTION-START[Properties]
202    // SECTION-END
203    // SECTION-START[Messages]
204    // SECTION-END
205}

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