|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstantiatingComponentAdapter
This ComponentAdapter will instantiate a new object for each call to
ComponentAdapter.getComponentInstance(PicoContainer)
.
That means that when used with a PicoContainer, getComponentInstance will
return a new object each time.
Nested Class Summary | |
protected static class |
InstantiatingComponentAdapter.Guard
|
Field Summary | |
protected boolean |
allowNonPublicClasses
Flag indicating instanciation of non-public classes. |
protected Parameter[] |
parameters
The parameters to use for initialization. |
protected InstantiatingComponentAdapter.Guard |
verifyingGuard
The cycle guard for the verification. |
Constructor Summary | |
protected |
InstantiatingComponentAdapter(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
Constructs a new ComponentAdapter for the given key and implementation. |
Method Summary | |
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
protected Parameter[] |
createDefaultParameters(Class[] parameters)
Create default parameters for the given types. |
protected abstract Constructor |
getGreediestSatisfiableConstructor(PicoContainer container)
Find and return the greediest satisfiable constructor. |
protected Object |
newInstance(Constructor constructor,
Object[] parameters)
Instantiate an object with given parameters and respect the accessible flag. |
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed. |
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter |
checkTypeCompatibility, getComponentImplementation, getComponentKey, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.picocontainer.ComponentAdapter |
getComponentInstance |
Field Detail |
protected transient InstantiatingComponentAdapter.Guard verifyingGuard
protected transient Parameter[] parameters
protected boolean allowNonPublicClasses
Constructor Detail |
protected InstantiatingComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters, boolean allowNonPublicClasses)
componentKey
- the search key for this implementationcomponentImplementation
- the concrete implementationparameters
- the parameters to use for the initializationallowNonPublicClasses
- flag to allow instantiation of non-public classes.
AssignabilityRegistrationException
- if the key is a type and the implementation cannot be assigned to.
NotConcreteRegistrationException
- if the implementation is not a concrete class.Method Detail |
protected Parameter[] createDefaultParameters(Class[] parameters)
parameters
- the parameter types
public void verify(PicoContainer container) throws PicoIntrospectionException
ComponentAdapter
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
PicoIntrospectionException
- if one or more dependencies cannot be resolved.public void accept(PicoVisitor visitor)
ComponentAdapter
PicoContainer
, that
cascades the visitor also down to all its ComponentAdapter instances.
accept
in interface ComponentAdapter
accept
in class AbstractComponentAdapter
protected Object newInstance(Constructor constructor, Object[] parameters) throws InstantiationException, IllegalAccessException, InvocationTargetException
constructor
- the constructor to useparameters
- the parameters for the constructor
InstantiationException
IllegalAccessException
InvocationTargetException
protected abstract Constructor getGreediestSatisfiableConstructor(PicoContainer container) throws PicoIntrospectionException, UnsatisfiableDependenciesException, AmbiguousComponentResolutionException, AssignabilityRegistrationException, NotConcreteRegistrationException
container
- the PicoContainer to resolve dependencies.
PicoIntrospectionException
UnsatisfiableDependenciesException
AmbiguousComponentResolutionException
AssignabilityRegistrationException
NotConcreteRegistrationException
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |