Class PicoBuilder


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

    Simple Example:

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

      • 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()
        Will be used to build a PicoContainer not bound to any parent container.
    • Method Detail

      • withReflectionLifecycle

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

        public PicoBuilder withLifecycle​(java.lang.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.
      • 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()
      • withHiddenImplementations

        public PicoBuilder withHiddenImplementations()
      • withSetterInjection

        public PicoBuilder withSetterInjection()
      • withAnnotatedMethodInjection

        public PicoBuilder withAnnotatedMethodInjection​(java.lang.Class<? extends java.lang.annotation.Annotation> injectionAnnotation)
      • withAnnotatedMethodInjection

        public PicoBuilder withAnnotatedMethodInjection()
      • withAnnotatedFieldInjection

        public PicoBuilder withAnnotatedFieldInjection​(java.lang.Class<? extends java.lang.annotation.Annotation> injectionAnnotation)
      • withAnnotatedFieldInjection

        public PicoBuilder withAnnotatedFieldInjection()
      • withTypedFieldInjection

        public PicoBuilder withTypedFieldInjection()
      • withConstructorInjection

        public PicoBuilder withConstructorInjection()
      • withNamedMethodInjection

        public PicoBuilder withNamedMethodInjection()
      • withNamedFieldInjection

        public PicoBuilder withNamedFieldInjection()
      • withSynchronizing

        public PicoBuilder withSynchronizing()
      • 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​(java.lang.Class<? extends ComponentFactory> componentFactoryClass)
      • withCustomContainerComponent

        public PicoBuilder withCustomContainerComponent​(java.lang.Object containerDependency)
      • withPropertyApplier

        public PicoBuilder withPropertyApplier()
      • withMethodInjection

        public PicoBuilder withMethodInjection()
      • addChildToParent

        public PicoBuilder addChildToParent()