|
![]() |
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
PicoContainer
API.
See:
Description
Interface Summary | |
ComponentAdapterFactory | A component adapter factory is responsible for creating
component adapters . |
CyclicDependencyGuard | TODO Auto-generated JavaDoc |
ObjectReference | A way to refer to objects that are stored in "awkward" places (for example inside a
HttpSession or ThreadLocal ). |
Class Summary | |
AbstractComponentAdapter | Base class for a ComponentAdapter with general functionality. |
AbstractPicoVisitor | Abstract PicoVisitor implementation. |
BasicComponentParameter | A BasicComponentParameter should be used to pass in a particular component as argument to a different component's constructor. |
BeanPropertyComponentAdapter | Decorating component adapter that can be used to set additional properties on a component in a bean style. |
BeanPropertyComponentAdapterFactory | A ComponentAdapterFactory that creates
BeanPropertyComponentAdapter instances. |
CachingComponentAdapter | This ComponentAdapter caches the instance. |
CachingComponentAdapterFactory | |
CollectionComponentParameter | A CollectionComponentParameter should be used to support inject an Array , a
Collection or Map of components automatically. |
ComponentParameter | A ComponentParameter should be used to pass in a particular component as argument to a different component's constructor. |
ConstantParameter | A ConstantParameter should be used to pass in "constant" arguments to constructors. |
ConstructorInjectionComponentAdapter | Instantiates components using Constructor Injection. |
ConstructorInjectionComponentAdapterFactory | |
DecoratingComponentAdapter | |
DecoratingComponentAdapterFactory | |
DefaultComponentAdapterFactory | Creates instances of ConstructorInjectionComponentAdapter decorated by
CachingComponentAdapter . |
DefaultPicoContainer |
The Standard PicoContainer /MutablePicoContainer implementation. |
InstanceComponentAdapter | |
InstantiatingComponentAdapter | This ComponentAdapter will instantiate a new object for each call to
ComponentAdapter.getComponentInstance(PicoContainer) . |
InstantiatingComponentAdapter.Guard | |
LifecycleVisitor | |
SetterInjectionComponentAdapter | Instantiates components using empty constructors and Setter Injection. |
SetterInjectionComponentAdapterFactory | A ComponentAdapterFactory for JavaBeans. |
SetterIntrospector | |
SimpleReference | |
SynchronizedComponentAdapter | |
SynchronizedComponentAdapterFactory | |
ThreadLocalCyclicDependencyGuard | Abstract utility class to detect recursion cycles. |
VerifyingVisitor | Visitor to verify PicoContainer instances. |
Exception Summary | |
AmbiguousComponentResolutionException | Exception that is thrown as part of the introspection. |
AssignabilityRegistrationException | A subclass of PicoRegistrationException that is thrown during component registration if the
component's key is a type and the implementation is not assignable to. |
CyclicDependencyException | |
DuplicateComponentKeyRegistrationException | |
NotConcreteRegistrationException | |
PicoInvocationTargetInitializationException | |
PicoVisitorTraversalException | Exception for a PicoVisitor, that is dependent on a defined starting point of the traversal. |
TooManySatisfiableConstructorsException | |
UnsatisfiableDependenciesException |
This package contains the default implementation of the PicoContainer
API. The main class in this package is DefaultPicoContainer
,
which satisfies both the PicoContainer
and
MutablePicoContainer
contracts. In addition, it allows passing in of a
ComponentAdapterFactory
, which can be used to customize the type
of ComponentAdapter
that is used for components that are added to the
container for which no component adapter is specified explicitly.
This page contains a brief low-level overview of the default picocontainer implementation package. Much more documentation is available on the PicoContainer website.
The implementation provided in this package is very extensible, embeddable and lightweight, to get a few buzzwords out of the way.
DefaultPicoContainer
a custom-written component
adapter factory, for example one that creates adapters that support a different kind of IoC. For
really advanced applications you may wish to subclass DefaultPicoContainer
.constructor
injection
,
which is used by default, and
setter
injection
), nothing more. With about 3 dozen classes, the picocontainer jar file (including the
PicoContainer API) is under a 100kb in size, small enough to use in just about any project.Almost all exceptions thrown in this package are subclasses of
PicoException
, which is a subclass of RuntimeException
.
Furthermore, those exceptions are usually be subclasses of the basic pico exception types specified
in the API. As an example, CyclicDependencyException
is a
specialization of PicoInitializationException
.
It is not recommended that you catch the specific exceptions thrown in this package (except perhaps if you're developing your own container based on this package). Rather catch the broader exception classes defined as part of the core PicoContainer API, and minimize the ties your application has to the implementation package.
Most of the ComponentAdapter
implementations in this package are
subclasses of either AbstractComponentAdapter
or
DecoratingComponentAdapter
. Subclasses of the former can
generally be used on their own, whereas subclasses of the latter wrap another ComponentAdapter,
providing slightly different behaviour or additional functionality. For example,
CachingComponentAdapter
extends
DecoratingComponentAdapter
. It can wrap any other adapter to
provide a singleton-like behaviour (where a single component instance is kept per container).
Contrast this with ConstructorInjectionComponentAdapter
(a
subclass of AbstractComponentAdapter
), which actually creates instances (using, in
this case, constructor dependency injection).
All component adapters in this package include a matching ComponentAdapterFactory
.
The classnames of those factories can always be found simply by appending "Factory" to the name of
the component adapter class. One adapter factory deserves special mention: DefaultComponentAdapterFactory
is the factory that is used by
DefaultPicoContainer
if none is explicitly specified.
It is recommended that you follow similar patterns if you write your own component adapters.
If you are not sure what type of adapter you need, it is often a good idea to start with a
decorating component adapter, so that you can mix and match functionality from the existing
adapters with your own. Also, always try to include a ComponentAdapterFactory
for your
custom adapter.
Advanced PicoContainer users may need to have full control over what parameters are fed to
components on instantiation, and the PicoContainer API provides this control via the
Parameter
class. The default implementation provides two commonly used
parameter implementations: ConstantParameter
for passing
"constants" (like primitive types and strings) to components and
ConstantParameter
for passing a specific argument to the
component by specifying the key that should be used in retrieving that argument from the
container.
|
![]() |
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |