Class PicoBuilder

java.lang.Object
org.picocontainer.PicoBuilder

public class PicoBuilder extends Object
Helps assembles the myriad items available to a picocontainer.

Simple Example:

 MutablePicoContainer mpc = new PicoBuilder()
   .withCaching()
   .withLifecycle()
   .build();
 
Author:
Paul Hammant
  • Constructor Details

    • PicoBuilder

      public PicoBuilder(PicoContainer parentContainer, InjectionFactory injectionType)
    • PicoBuilder

      public PicoBuilder(PicoContainer parentContainer)
      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

      public PicoBuilder(InjectionFactory injectionType)
    • PicoBuilder

      public PicoBuilder()
      Will be used to build a PicoContainer not bound to any parent container.
  • Method Details

    • withLifecycle

      public PicoBuilder withLifecycle()
    • withReflectionLifecycle

      public PicoBuilder withReflectionLifecycle()
      Constructed PicoContainer will use ReflectionLifecycle.
      Returns:
      this to allow for method chaining.
    • withLifecycle

      public PicoBuilder withLifecycle(Class<? extends LifecycleStrategy> specifiedLifecycleStrategyType)
      Allows you to specify your own lifecycle strategy class.
      Parameters:
      specifiedLifecycleStrategyType - lifecycle strategy type.
      Returns:
      this to allow for method chaining.
    • withJavaEE5Lifecycle

      public PicoBuilder withJavaEE5Lifecycle()
      Constructed PicoContainer will use JavaEE5LifecycleStrategy.
      Returns:
      this to allow for method chaining.
    • withLifecycle

      public PicoBuilder withLifecycle(LifecycleStrategy specifiedLifecycleStrategy)
      Allows you to fully specify your lifecycle strategy by passing in a built instance
      Parameters:
      specifiedLifecycleStrategy -
      Returns:
      this to allow for method chaining.
    • withConsoleMonitor

      public PicoBuilder withConsoleMonitor()
    • withMonitor

      public PicoBuilder withMonitor(Class<? extends ComponentMonitor> cmClass)
    • build

      public MutablePicoContainer build()
    • withHiddenImplementations

      public PicoBuilder withHiddenImplementations()
    • withSetterInjection

      public PicoBuilder withSetterInjection()
    • withAnnotatedMethodInjection

      public PicoBuilder withAnnotatedMethodInjection(Class<? extends Annotation> injectionAnnotation)
    • withAnnotatedMethodInjection

      public PicoBuilder withAnnotatedMethodInjection()
    • withAnnotatedFieldInjection

      public PicoBuilder withAnnotatedFieldInjection(Class<? extends Annotation> injectionAnnotation)
    • withAnnotatedFieldInjection

      public PicoBuilder withAnnotatedFieldInjection()
    • withTypedFieldInjection

      public PicoBuilder withTypedFieldInjection()
    • withConstructorInjection

      public PicoBuilder withConstructorInjection()
    • withNamedMethodInjection

      public PicoBuilder withNamedMethodInjection()
    • withNamedFieldInjection

      public PicoBuilder withNamedFieldInjection()
    • withCaching

      public PicoBuilder withCaching()
    • withComponentFactory

      public PicoBuilder withComponentFactory(ComponentFactory componentFactory)
    • withSynchronizing

      public PicoBuilder withSynchronizing()
    • withLocking

      public PicoBuilder withLocking()
    • withBehaviors

      public PicoBuilder withBehaviors(BehaviorFactory... factories)
    • implementedBy

      public PicoBuilder implementedBy(Class<? extends MutablePicoContainer> containerClass)
    • withMonitor

      public PicoBuilder withMonitor(ComponentMonitor specifiedComponentMonitor)
      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

      public PicoBuilder withComponentFactory(Class<? extends ComponentFactory> componentFactoryClass)
    • withCustomContainerComponent

      public PicoBuilder withCustomContainerComponent(Object containerDependency)
    • withPropertyApplier

      public PicoBuilder withPropertyApplier()
    • withAutomatic

      public PicoBuilder withAutomatic()
    • withMethodInjection

      public PicoBuilder withMethodInjection()
    • addChildToParent

      public PicoBuilder addChildToParent()
    • addInjector

      protected void addInjector(InjectionFactory injectionType)