コード例 #1
0
 private Object makeInstance(
     PicoContainer container, Constructor constructor, ComponentMonitor monitor) {
   long startTime = System.currentTimeMillis();
   Constructor constructorToUse =
       monitor.instantiating(container, IterativeInjector.this, constructor);
   Object componentInstance;
   try {
     componentInstance = newInstance(constructorToUse, null);
   } catch (InvocationTargetException e) {
     monitor.instantiationFailed(container, IterativeInjector.this, constructorToUse, e);
     if (e.getTargetException() instanceof RuntimeException) {
       throw (RuntimeException) e.getTargetException();
     } else if (e.getTargetException() instanceof Error) {
       throw (Error) e.getTargetException();
     }
     throw new PicoCompositionException(e.getTargetException());
   } catch (InstantiationException e) {
     return caughtInstantiationException(monitor, constructor, e, container);
   } catch (IllegalAccessException e) {
     return caughtIllegalAccessException(monitor, constructor, e, container);
   }
   monitor.instantiated(
       container,
       IterativeInjector.this,
       constructorToUse,
       componentInstance,
       NONE,
       System.currentTimeMillis() - startTime);
   return componentInstance;
 }
コード例 #2
0
 public <T> Constructor<T> instantiating(
     PicoContainer container, ComponentAdapter<T> componentAdapter, Constructor<T> constructor) {
   out.println(format(ComponentMonitorHelper.INSTANTIATING, ctorToString(constructor)));
   return delegate.instantiating(container, componentAdapter, constructor);
 }
コード例 #3
0
 public <T> Constructor<T> instantiating(
     PicoContainer container, ComponentAdapter<T> componentAdapter, Constructor<T> constructor) {
   return delegate.instantiating(container, componentAdapter, constructor);
 }