Interface Parameter

All Known Implementing Classes:
AbstractParameter, BasicComponentParameter, CollectionComponentParameter, ComponentParameter, ConstantParameter, DefaultConstructorParameter, NullParameter

public interface Parameter
This class provides control over the arguments that will be passed to a constructor. It can be used for finer control over what arguments are passed to a particular constructor.
Author:
Jon Tirsén, Aslak Hellesøy, Thomas Heller
See Also:
  • Field Details

    • ZERO

      static final Parameter[] ZERO
      Zero parameter is used when you wish a component to be instantiated with its default constructor. Ex:
                      MutablePicoContainer mpc = new PicoBuilder().build();
                      mpc.addComponent(Map.class, HashMap.class, Parameter.ZERO);
                      mpc.addComponent(List.class, ArrayList.class, Parameter.ZERO);
              

      By specifying the default constructor in this example code, you allow PicoContainer to recognize that HashMap(Collection) should not be used and avoid a CircularDependencyException.

    • DEFAULT

      static final Parameter[] DEFAULT
  • Method Details

    • resolve

      Parameter.Resolver resolve(PicoContainer container, ComponentAdapter<?> forAdapter, ComponentAdapter<?> injecteeAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
      Check if the Parameter can satisfy the expected type using the container.
      Parameters:
      container - the container from which dependencies are resolved.
      forAdapter - the ComponentAdapter that is asking for the instance
      injecteeAdapter - the adapter to be injected into (null for N/A)
      expectedType - the required type
      expectedNameBinding - Expected parameter name
      useNames - should use parameter names for disambiguation
      binding -
      Returns:
      true if the component parameter can be resolved.
      Since:
      2.8.1
    • verify

      void verify(PicoContainer container, ComponentAdapter<?> adapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
      Verify that the Parameter can satisfy the expected type using the container
      Parameters:
      container - the container from which dependencies are resolved.
      adapter - the ComponentAdapter that is asking for the verification
      expectedType - the required type
      expectedNameBinding - Expected parameter name
      useNames -
      binding -
      Throws:
      PicoCompositionException - if parameter and its dependencies cannot be resolved
    • accept

      void accept(PicoVisitor visitor)
      Accepts a visitor for this Parameter. The method is normally called by visiting a ComponentAdapter, that cascades the visitor also down to all its Parameters.
      Parameters:
      visitor - the visitor.
    • resolveInstance

      @Deprecated Object resolveInstance(PicoContainer container, ComponentAdapter<?> forAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
      Deprecated.
    • isResolvable

      @Deprecated boolean isResolvable(PicoContainer container, ComponentAdapter<?> forAdapter, Type expectedType, NameBinding expectedNameBinding, boolean useNames, Annotation binding)
      Deprecated.