public static InjectionType adaptiveDI() { return new AdaptingInjection(); }
private <T> InjectionType fieldAnnotatedInjectionAdapter(final Class<T> impl) { if (injectionFieldAnnotated(impl)) { return this.annotatedFieldInjection; } return null; }
private <T> InjectionType methodAnnotatedInjectionAdapter(final Class<T> impl) { if (injectionMethodAnnotated(impl)) { return annotatedMethodInjection; } return null; }
verifyNamedParameters(impl, fieldParams, methodParams); componentAdapter = setterInjectionAdapter(componentProps); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = methodInjectionAdapter(componentProps); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = methodAnnotatedInjectionAdapter(impl); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = fieldAnnotatedInjectionAdapter(impl); if (componentAdapter != null) { injectors.add(componentAdapter); injectors.add(defaultInjectionAdapter(componentProps));
throwCompositionException(impl, eachParam); throwCompositionException(impl, eachParam);
verifyNamedParameters(impl, fieldParams, methodParams); componentAdapter = setterInjectionAdapter(componentProps); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = methodInjectionAdapter(componentProps); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = methodAnnotatedInjectionAdapter(impl); if (componentAdapter != null) { injectors.add(componentAdapter); componentAdapter = fieldAnnotatedInjectionAdapter(impl); if (componentAdapter != null) { injectors.add(componentAdapter); injectors.add(defaultInjectionAdapter(componentProps));
throwCompositionException(impl, eachParam); throwCompositionException(impl, eachParam);
protected AdaptingInjection makeInjectionFactory() { return new AdaptingInjection(); }
private <T> InjectionType fieldAnnotatedInjectionAdapter(final Class<T> impl) { if (injectionFieldAnnotated(impl)) { return this.annotatedFieldInjection; } return null; }
private <T> InjectionType methodAnnotatedInjectionAdapter(final Class<T> impl) { if (injectionMethodAnnotated(impl)) { return annotatedMethodInjection; } return null; }
public static InjectionType adaptiveDI() { return new AdaptingInjection(); }
protected AdaptingInjection makeInjectionFactory() { return new AdaptingInjection(); }
protected ComponentFactory createDefaultComponentFactory() { return new AdaptingInjection(); }
private ComponentAdapter<?> createComponentAdapter(final String className, final ClassLoader classLoader) { Class<?> implementation = loadClass(classLoader, className); ComponentFactory factory = new AdaptingInjection(); return factory.createComponentAdapter(new NullComponentMonitor(), new NullLifecycleStrategy(), new Properties(), className, implementation, //Adapting injection will now support simultanous constructor //and other types of injection (since 3.0) //Must provide empty parameter array to use the default constructor. // new ConstructorParameters(new Parameter[0]), null, null); }
public <T> ComponentAdapter<T> createComponentAdapter(final ComponentMonitor monitor, final LifecycleStrategy lifecycle, final Properties componentProps, final Object key, final Class<T> impl, final ConstructorParameters constructorParams, final FieldParameters[] fieldParams, final MethodParameters[] methodParams) throws PicoCompositionException { if (delegate == null) { delegate = new AdaptingInjection(); } ComponentAdapter<T> compAdapter = delegate.createComponentAdapter(monitor, lifecycle, componentProps, key, impl, constructorParams, fieldParams, methodParams); boolean enableCircular = removePropertiesIfPresent(componentProps, Characteristics.ENABLE_CIRCULAR); if (enableCircular && delegate instanceof InjectionType) { return monitor.changedBehavior(new ImplementationHiding.HiddenImplementation<T>(compAdapter)); } else { return compAdapter; } }
public <T> ComponentAdapter<T> createComponentAdapter(final ComponentMonitor monitor, final LifecycleStrategy lifecycle, final Properties componentProps, final Object key, final Class<T> impl, final ConstructorParameters constructorParams, final FieldParameters[] fieldParams, final MethodParameters[] methodParams) throws PicoCompositionException { if (delegate == null) { delegate = new AdaptingInjection(); } ComponentAdapter<T> compAdapter = delegate.createComponentAdapter(monitor, lifecycle, componentProps, key, impl, constructorParams, fieldParams, methodParams); boolean enableCircular = removePropertiesIfPresent(componentProps, Characteristics.ENABLE_CIRCULAR); if (enableCircular && delegate instanceof InjectionType) { return monitor.changedBehavior(new ImplementationHiding.HiddenImplementation<T>(compAdapter)); } else { return compAdapter; } }