Package org.picocontainer
Class PicoBuilder
java.lang.Object
org.picocontainer.PicoBuilder
Helps assembles the myriad items available to a picocontainer.
Simple Example:
MutablePicoContainer mpc = new PicoBuilder() .withCaching() .withLifecycle() .build();
- Author:
- Paul Hammant
-
Constructor Summary
ConstructorsConstructorDescriptionWill be used to build a PicoContainer not bound to any parent container.PicoBuilder
(InjectionFactory injectionType) PicoBuilder
(PicoContainer parentContainer) Constructs a PicoBuilder using the specified PicoContainer as an argument.PicoBuilder
(PicoContainer parentContainer, InjectionFactory injectionType) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addInjector
(InjectionFactory injectionType) build()
implementedBy
(Class<? extends MutablePicoContainer> containerClass) withAnnotatedFieldInjection
(Class<? extends Annotation> injectionAnnotation) withAnnotatedMethodInjection
(Class<? extends Annotation> injectionAnnotation) withBehaviors
(BehaviorFactory... factories) withComponentFactory
(Class<? extends ComponentFactory> componentFactoryClass) withComponentFactory
(ComponentFactory componentFactory) withCustomContainerComponent
(Object containerDependency) Constructed PicoContainer will use JavaEE5LifecycleStrategy.withLifecycle
(Class<? extends LifecycleStrategy> specifiedLifecycleStrategyType) Allows you to specify your own lifecycle strategy class.withLifecycle
(LifecycleStrategy specifiedLifecycleStrategy) Allows you to fully specify your lifecycle strategy by passing in a built instancewithMonitor
(Class<? extends ComponentMonitor> cmClass) withMonitor
(ComponentMonitor specifiedComponentMonitor) Allows you to specify your very own component monitor to be used by the created picocontainerConstructed PicoContainer will use ReflectionLifecycle.
-
Constructor Details
-
PicoBuilder
-
PicoBuilder
Constructs a PicoBuilder using the specified PicoContainer as an argument. Note that this only creates child -> parent references. You must use parentContainer.addChildContainer() to the instance built here if you require child <-> parent references.- Parameters:
parentContainer
-
-
PicoBuilder
-
PicoBuilder
public PicoBuilder()Will be used to build a PicoContainer not bound to any parent container.
-
-
Method Details
-
withLifecycle
-
withReflectionLifecycle
Constructed PicoContainer will use ReflectionLifecycle.- Returns:
- this to allow for method chaining.
-
withLifecycle
Allows you to specify your own lifecycle strategy class.- Parameters:
specifiedLifecycleStrategyType
- lifecycle strategy type.- Returns:
- this to allow for method chaining.
-
withJavaEE5Lifecycle
Constructed PicoContainer will use JavaEE5LifecycleStrategy.- Returns:
- this to allow for method chaining.
-
withLifecycle
Allows you to fully specify your lifecycle strategy by passing in a built instance- Parameters:
specifiedLifecycleStrategy
-- Returns:
- this to allow for method chaining.
-
withConsoleMonitor
-
withMonitor
-
build
-
withHiddenImplementations
-
withSetterInjection
-
withAnnotatedMethodInjection
-
withAnnotatedMethodInjection
-
withAnnotatedFieldInjection
-
withAnnotatedFieldInjection
-
withTypedFieldInjection
-
withConstructorInjection
-
withNamedMethodInjection
-
withNamedFieldInjection
-
withCaching
-
withComponentFactory
-
withSynchronizing
-
withLocking
-
withBehaviors
-
implementedBy
-
withMonitor
Allows you to specify your very own component monitor to be used by the created picocontainer- Parameters:
specifiedComponentMonitor
-- Returns:
- this to allow for method chaining.
-
withComponentFactory
-
withCustomContainerComponent
-
withPropertyApplier
-
withAutomatic
-
withMethodInjection
-
addChildToParent
-
addInjector
-