public static InjectionType CDI() { return new ConstructorInjection(); }
public static InjectionType CDI() { return new ConstructorInjection(); }
public static <T> T neu(final Class<T> type, final Emjection emjection, final Object... args) { if (emjection.pico == null) { throw new PicoCompositionException("blah"); } TransientPicoContainer tpc = new TransientPicoContainer(new ConstructorInjection(), emjection.pico); for (Object arg : args) { tpc.addComponent(arg); } T inst = tpc.getComponentInto(type, ComponentAdapter.NOTHING.class); if (inst == null) { tpc.addComponent(type); inst = tpc.getComponentInto(type, ComponentAdapter.NOTHING.class); } setPico(inst, tpc); return inst; }
public static <T> T neu(final Class<T> type, final Emjection emjection, final Object... args) { if (emjection.pico == null) { throw new PicoCompositionException("blah"); } TransientPicoContainer tpc = new TransientPicoContainer(new ConstructorInjection(), emjection.pico); for (Object arg : args) { tpc.addComponent(arg); } T inst = tpc.getComponentInto(type, ComponentAdapter.NOTHING.class); if (inst == null) { tpc.addComponent(type); inst = tpc.getComponentInto(type, ComponentAdapter.NOTHING.class); } setPico(inst, tpc); return inst; }
public TransientPicoContainer() { super(null, new NullLifecycleStrategy(), new NullComponentMonitor(), new Caching().wrap(new ConstructorInjection())); }
public TransientPicoContainer(final PicoContainer parent) { super(parent, new NullLifecycleStrategy(), new NullComponentMonitor(), new Caching().wrap(new ConstructorInjection())); }
public TransientPicoContainer() { super(null, new NullLifecycleStrategy(), new NullComponentMonitor(), new Caching().wrap(new ConstructorInjection())); }
public TransientPicoContainer(final PicoContainer parent) { super(parent, new NullLifecycleStrategy(), new NullComponentMonitor(), new Caching().wrap(new ConstructorInjection())); }
final protected PicoContainer wrapComponentInstances( final Class decoratingComponentAdapterClass, final PicoContainer picoContainer, final Object[] wrapperDependencies) { assertTrue(AbstractBehavior.AbstractChangedBehavior.class.isAssignableFrom(decoratingComponentAdapterClass)); final MutablePicoContainer mutablePicoContainer = new DefaultPicoContainer(); final int size = (wrapperDependencies != null ? wrapperDependencies.length : 0) + 1; final Collection allComponentAdapters = picoContainer.getComponentAdapters(); for (Object allComponentAdapter : allComponentAdapters) { final Parameter[] parameters = new Parameter[size]; parameters[0] = new ConstantParameter(allComponentAdapter); for (int i = 1; i < parameters.length; i++) { parameters[i] = new ConstantParameter(wrapperDependencies[i - 1]); } final MutablePicoContainer instantiatingPicoContainer = new DefaultPicoContainer( new ConstructorInjection()); instantiatingPicoContainer.addComponent( "decorator", decoratingComponentAdapterClass, parameters); mutablePicoContainer.addAdapter((ComponentAdapter)instantiatingPicoContainer .getComponent("decorator")); } return mutablePicoContainer; }
private ComponentFactory createComponentFactory(final String factoryName, final ClassLoadingPicoContainer metaContainer) throws PicoCompositionException { if (notSet(factoryName)) { return new Caching().wrap(new ConstructorInjection()); } final Serializable key; if (metaContainer.getComponentAdapter(factoryName) != null) { key = factoryName; } else { metaContainer.addComponent(ComponentFactory.class, new ClassName(factoryName)); key = ComponentFactory.class; } return (ComponentFactory) metaContainer.getComponent(key); }