EMMA Coverage Report (generated Tue Jan 19 17:53:40 UTC 2010)
[all classes][org.jomc.ri]

COVERAGE SUMMARY FOR SOURCE FILE [DefaultInvocation.java]

nameclass, %method, %block, %line, %
DefaultInvocation.java100% (1/1)67%  (8/12)77%  (117/151)73%  (19/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultInvocation100% (1/1)67%  (8/12)77%  (117/151)73%  (19/26)
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)
setResult (Object): void 100% (1/1)60%  (9/15)75%  (3/4)
<static initializer> 100% (1/1)100% (71/71)100% (7/7)
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)

1// SECTION-START[License Header]
2// <editor-fold defaultstate="collapsed" desc=" Generated License ">
3/*
4 *   Copyright (c) 2010 The JOMC Project
5 *   Copyright (c) 2005 Christian Schulte <cs@jomc.org>
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 BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
21 *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
24 *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *   $Id: DefaultInvocation.java 1346 2010-01-19 12:16:43Z schulte2005 $
33 *
34 */
35// </editor-fold>
36// SECTION-END
37package org.jomc.ri;
38 
39import java.lang.reflect.Method;
40import java.util.HashMap;
41import java.util.Map;
42import org.jomc.model.Instance;
43import org.jomc.model.Modules;
44import org.jomc.spi.Invocation;
45 
46// SECTION-START[Documentation]
47// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
48/**
49 * Default invocation.
50 *
51 * @author <a href="mailto:cs@jomc.org">Christian Schulte</a> 1.0
52 * @version $Id: DefaultInvocation.java 1346 2010-01-19 12:16:43Z schulte2005 $
53 */
54// </editor-fold>
55// SECTION-END
56// SECTION-START[Annotations]
57// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
58@javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
59                             comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-15/jomc-tools" )
60// </editor-fold>
61// SECTION-END
62public class DefaultInvocation implements Invocation
63{
64    // SECTION-START[DefaultInvocation]
65 
66    /** Constant for the context key of the {@code Object} of this invocation. */
67    public static final String OBJECT_KEY = Invocation.class.getName() + ".object";
68 
69    /** Constant for the context key of the {@code Method} of this invocation. */
70    public static final String METHOD_KEY = Invocation.class.getName() + ".method";
71 
72    /** Constant for the context key of the {@code Object[]} arguments of this invocation. */
73    public static final String ARGUMENTS_KEY = Invocation.class.getName() + ".arguments";
74 
75    /** Constant for the context key of the result {@code Object} of this invocation. */
76    public static final String RESULT_KEY = Invocation.class.getName() + ".result";
77 
78    /** Constant for the context key of the {@code Instance} corresponding to the object of this invocation. */
79    public static final String INSTANCE_KEY = Invocation.class.getName() + ".instance";
80 
81    /** Constant for the context key of the {@code Modules} corresponding to the object of this invocation. */
82    public static final String MODULES_KEY = Invocation.class.getName() + ".modules";
83 
84    /** Constant for the context key of the {@code ClassLoader} corresponding to the modules of this invocation. */
85    public static final String CLASSLOADER_KEY = Invocation.class.getName() + ".classLoader";
86 
87    /** The context of this invocation. */
88    private Map context;
89 
90    /**
91     * Creates a new {@code DefaultInvocation} instance taking an invocation to initialize the instance with.
92     *
93     * @param invocation The invocation to initialize the instance with.
94     */
95    public DefaultInvocation( final Invocation invocation )
96    {
97        this.context = new HashMap( invocation.getContext() );
98    }
99 
100    public Map getContext()
101    {
102        if ( this.context == null )
103        {
104            this.context = new HashMap();
105        }
106 
107        return this.context;
108    }
109 
110    public Object getObject()
111    {
112        return this.getContext().get( OBJECT_KEY );
113    }
114 
115    public Method getMethod()
116    {
117        return (Method) this.getContext().get( METHOD_KEY );
118    }
119 
120    public Object[] getArguments()
121    {
122        return (Object[]) this.getContext().get( ARGUMENTS_KEY );
123    }
124 
125    public Object getResult()
126    {
127        return this.getContext().get( RESULT_KEY );
128    }
129 
130    public void setResult( final Object value )
131    {
132        if ( value == null )
133        {
134            this.getContext().remove( RESULT_KEY );
135        }
136        else
137        {
138            this.getContext().put( RESULT_KEY, value );
139        }
140    }
141 
142    /**
143     * Gets the instance of the object of this invocation from the context of this invocation.
144     *
145     * @return The instance of the object of this invocation from the context of this invocation or {@code null}.
146     *
147     * @see #INSTANCE_KEY
148     */
149    public Instance getInstance()
150    {
151        return (Instance) this.getContext().get( INSTANCE_KEY );
152    }
153 
154    /**
155     * Gets the modules corresponding to the object of this invocation from the context of this invocation.
156     *
157     * @return The modules corresponding to the object of this invocation from the context of this invocation or
158     * {@code null}.
159     *
160     * @see #MODULES_KEY
161     */
162    public Modules getModules()
163    {
164        return (Modules) this.getContext().get( MODULES_KEY );
165    }
166 
167    /**
168     * Gets the class loader corresponding to the modules of this invocation from the context of this invocation.
169     *
170     * @return The class loader corresponding to the modules of this invocation from the context of this invocation or
171     * {@code null}.
172     *
173     * @see #CLASSLOADER_KEY
174     */
175    public ClassLoader getClassLoader()
176    {
177        return (ClassLoader) this.getContext().get( CLASSLOADER_KEY );
178    }
179 
180    // SECTION-END
181    // SECTION-START[Constructors]
182    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
183 
184    /** Creates a new {@code DefaultInvocation} instance. */
185    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
186                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-15/jomc-tools" )
187    public DefaultInvocation()
188    {
189        // SECTION-START[Default Constructor]
190        super();
191        // SECTION-END
192    }
193    // </editor-fold>
194    // SECTION-END
195    // SECTION-START[Dependencies]
196    // SECTION-END
197    // SECTION-START[Properties]
198    // SECTION-END
199    // SECTION-START[Messages]
200    // SECTION-END
201}

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