EMMA Coverage Report (generated Wed Aug 29 00:03:59 CDT 2007)
[all classes][org.fuwjax.jon.type]

COVERAGE SUMMARY FOR SOURCE FILE [NaiveInstantiator.java]

nameclass, %method, %block, %line, %
NaiveInstantiator.java100% (1/1)50%  (1/2)50%  (8/16)43%  (3/7)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NaiveInstantiator100% (1/1)50%  (1/2)50%  (8/16)43%  (3/7)
NaiveInstantiator (): void 0%   (0/1)0%   (0/3)0%   (0/2)
create (Class): Object 100% (1/1)62%  (8/13)60%  (3/5)

1/*
2 * This file is part of JON.
3 *
4 * JON is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * JON is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 * 
17 * Copyright 2007 Michael Doberenz
18 */
19package org.fuwjax.jon.type;
20 
21import org.fuwjax.jon.ObjectAccessException;
22 
23/**
24 * Instantiates objects using Class.newInstance().
25 * @author michaeldoberenz
26 */
27public final class NaiveInstantiator{
28        private NaiveInstantiator(){
29                // for utility
30        }
31 
32        /**
33         * Creates a new instance of <code>type</code>.
34         * @param type the class of the new instance
35         * @return the new instance
36         * @throws ObjectAccessException if the object cannot be created
37         */
38        public static Object create(final Class<?> type) throws ObjectAccessException{
39                try{
40                        return type.newInstance();
41                }catch(InstantiationException e){
42                        throw ObjectAccessException.Message.NaiveCreationFailed.exception(e);
43                }catch(IllegalAccessException e){
44                        throw ObjectAccessException.Message.ConstructorInaccessible.exception(e);
45                }
46        }
47}

[all classes][org.fuwjax.jon.type]
EMMA 2.0.5312 (C) Vladimir Roubtsov