View Javadoc
1 /****************************************************************************** 2 * Copyright (C) PicoContainer Organization. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the license.html file. * 7 * * 8 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant * 9 *****************************************************************************/ 10 11 package picocontainer.defaults; 12 13 import picocontainer.ComponentFactory; 14 import picocontainer.PicoInvocationTargetInitailizationException; 15 16 import java.lang.reflect.Constructor; 17 import java.lang.reflect.InvocationTargetException; 18 19 public class DefaultComponentFactory implements ComponentFactory { 20 public Object createComponent(Class compType, Constructor constructor, Object[] args) throws PicoInvocationTargetInitailizationException { 21 try { 22 return constructor.newInstance(args); 23 } catch (InvocationTargetException e) { 24 throw new PicoInvocationTargetInitailizationException(e.getCause()); 25 } catch (InstantiationException e) { 26 throw new RuntimeException("#1 Can we have a concerted effort to try to force these excptions?"); 27 } catch (IllegalAccessException e) { 28 throw new RuntimeException("#2 Can we have a concerted effort to try to force these excptions?"); 29 } 30 } 31 }

This page was automatically generated by Maven