/** * Loads a binding with a specifc class into a context. * * @param bindingClass The class of the binding. * @param context The context which is to contain the binding. * @return The binding object of the associated type, otherwise null if no such binding could be * created. */ public Binding loadBinding(QName qName, Class bindingClass, PicoContainer context) { // instantiate within the given context ComponentAdapter adapter = new ConstructorInjectionComponentAdapter(qName, bindingClass); return (Binding) adapter.getComponentInstance(context); }
/** * Returns the component adapter for a binding with the specified name. * * @param type The qualified name of the type of the binding. * @return The binding class, or null if no such class exists. */ protected ComponentAdapter getBinding(QName type) { Object o = bindings.get(type); if (o == null) { return null; } if (o instanceof ComponentAdapter) { return (ComponentAdapter) o; } if (o instanceof Class) { return new ConstructorInjectionComponentAdapter(null, (Class) o); } return new InstanceComponentAdapter(null, o); } }
public ComponentAdapter getComponentAdapter(Object componentKey) { if (componentKey == null) { return null; } Object o = get(componentKey); if (o == null) { return null; } if (o instanceof Class) { // TODO: determine which form of injection to use return new ConstructorInjectionComponentAdapter(componentKey, (Class) o); } return new InstanceComponentAdapter(componentKey, o); }
public CurrentTimeUtilComponentAdapter() { super(new ConstructorInjectionComponentAdapter(CurrentTimeUtil.class, CurrentTimeUtil.class)); }
public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { return new ConstructorInjectionComponentAdapter(componentKey, componentImplementation, parameters, allowNonPublicClasses, currentMonitor(), lifecycleStrategy); } }
public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { return new CachingComponentAdapter(new ConstructorInjectionComponentAdapter(componentKey, componentImplementation, parameters, false, currentMonitor(), lifecycleStrategy)); }
/** * Loads a binding with a specifc class into a context. * * @param bindingClass The class of the binding. * @param context The context which is to contain the binding. * * @return The binding object of the associated type, otherwise null if * no such binding could be created. * */ public Binding loadBinding(QName qName, Class bindingClass, MutablePicoContainer context) { //instantiate within the given context ComponentAdapter adapter = new ConstructorInjectionComponentAdapter( qName, bindingClass ); return (Binding) adapter.getComponentInstance( context ); }
/** * Returns the component adapter for a binding with the specified name. * * @param type The qualified name of the type of the binding. * * @return The binding class, or null if no such class exists. */ protected ComponentAdapter getBinding(QName type) { Object o = bindings.get( type ); if ( o == null ) { return null; } if ( o instanceof Class ) { return new ConstructorInjectionComponentAdapter( null, (Class) o ); } return new InstanceComponentAdapter( null, o ); } }
public ComponentAdapter getComponentAdapter(Object componentKey) { if ( componentKey == null ) { return null; } Object o = get( componentKey ); if ( o == null ) { return null; } if ( o instanceof Class ) { //TODO: determine which form of injection to use return new ConstructorInjectionComponentAdapter( componentKey, (Class) o ); } return new InstanceComponentAdapter( componentKey, o ); }
private static void registerEvaluationContextFactory(final MutablePicoContainer container) { // PoolingEvaluationContextFactory depends on DefaultEvaluationContextFactory. // however both implement the same interface users depend on which causes an ambiguity. // therefore DefaultEvaluationContextFactory should be only visible to PoolingEvaluationContextFactory. final ConstructorInjectionComponentAdapter _serviceCA = new ConstructorInjectionComponentAdapter(DefaultEvaluationContextFactory.class, DefaultEvaluationContextFactory.class); final ConstructorInjectionComponentAdapter _poolingServiceCA = new ConstructorInjectionComponentAdapter(EvaluationContextFactory.class, PoolingEvaluationContextFactory.class, new Parameter[] {BasicComponentParameter.BASIC_DEFAULT, new BasicComponentParameter(DefaultEvaluationContextFactory.class)}); final LocalParameterComponentAdapter _localParamCA = new LocalParameterComponentAdapter(_poolingServiceCA, new ComponentAdapter[] {_serviceCA}); final ComponentAdapter _cachingCA = new CachingComponentAdapter(_localParamCA); container.registerComponent(_cachingCA); }
private static void registerCoreServices(final MutablePicoContainer container) { container.registerComponent(new CachingComponentAdapter( new PushTaskExecutorFactoryComponentAdapter( new ConstructorInjectionComponentAdapter(PushTaskExecutorFactory.class, ConfigurablePushTaskExecutorFactory.class)))); // etcl evaluator container.registerComponentImplementation(DefaultETCLEvaluator.class); // message factory container.registerComponentImplementation(DefaultMessageFactory.class); // taskprocessor container.registerComponentImplementation(DefaultTaskFactory.class); container.registerComponentImplementation(DefaultTaskProcessor.class); registerEvaluationContextFactory(container); }