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.txt file. * 7 * * 8 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant * 9 *****************************************************************************/ 10 11 package picocontainer.hierarchical; 12 13 import picocontainer.testmodel.Wilma; 14 import picocontainer.testmodel.WilmaImpl; 15 import picocontainer.PicoInvocationTargetInitailizationException; 16 17 import java.lang.reflect.Constructor; 18 import java.lang.reflect.InvocationTargetException; 19 import java.util.ArrayList; 20 import java.util.List; 21 22 public class OverriddenPicoTestContainer extends HierarchicalPicoContainer.Default 23 { 24 private Wilma wilma; 25 26 public OverriddenPicoTestContainer(Wilma wilma) 27 { 28 this.wilma = wilma; 29 } 30 31 protected Object makeComponentInstance(Class compType, Constructor constructor, Object[] args) throws PicoInvocationTargetInitailizationException { 32 33 if (constructor.getDeclaringClass() == WilmaImpl.class) { 34 return wilma; 35 } 36 return super.makeComponentInstance(compType, constructor, args); 37 } 38 39 40 }

This page was automatically generated by Maven