|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ComponentProvider
A provider for the instantiation and management of components.
The runtime will defer to a registered component provider (if present) for every component (application-defined or infrastructure-defined) that needs to be instantiated. If the component provider does not support the requested component it should return a null value and the runtime will attempt to directly instantiate and manage the component.
Nested Class Summary | |
---|---|
static class |
ComponentProvider.Scope
The scope contract for the instantiation of a component. |
Method Summary | ||
---|---|---|
|
getInjectableInstance(T instance)
Get the injectable instance to inject onto fields of the instance. |
|
|
getInstance(ComponentContext cc,
ComponentProvider.Scope scope,
java.lang.Class<T> c)
Get the instance of a class. |
|
|
getInstance(ComponentProvider.Scope scope,
java.lang.Class<T> c)
Get the instance of a class. |
|
|
getInstance(ComponentProvider.Scope scope,
java.lang.reflect.Constructor<T> contructor,
java.lang.Object[] parameters)
Get the instance of a class using a constructor and a corresponding array of parameter values. |
|
void |
inject(java.lang.Object instance)
Perform injection on an instance. |
Method Detail |
---|
<T> T getInstance(ComponentProvider.Scope scope, java.lang.Class<T> c) throws java.lang.InstantiationException, java.lang.IllegalAccessException
T
- the type to inject.scope
- the scope of the instancec
- the class
java.lang.InstantiationException
- if the component could not be
instantiated.
java.lang.IllegalAccessException
- if there was an error accessing
the definition of the component class.<T> T getInstance(ComponentProvider.Scope scope, java.lang.reflect.Constructor<T> contructor, java.lang.Object[] parameters) throws java.lang.InstantiationException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
The array of parameter values must be the same length as that required by the constructor. Some parameter values may be null, indicating that the values are not set and must be set by the component provider before construction occurs.
T
- the type to inject.scope
- the scope of the instancecontructor
- the constructor to instantiate the classparameters
- the array parameter values passed to the constructor
java.lang.InstantiationException
- if the component could not be
instantiated.
java.lang.IllegalAccessException
- if there was an error accessing
the definition of the component constructor.
java.lang.IllegalArgumentException
- if the number of parameters
differ or a parameter instance does not conform to the
approprate type.
java.lang.reflect.InvocationTargetException
<T> T getInstance(ComponentContext cc, ComponentProvider.Scope scope, java.lang.Class<T> c) throws java.lang.InstantiationException, java.lang.IllegalAccessException
Implementations wishing to ignore the component context may defer
to the implemented method getInstance(Scope, Class)
.
T
- the type to inject.cc
- the component contextscope
- the scope of the instancec
- the class
java.lang.InstantiationException
- if the component could not be
instantiated.
java.lang.IllegalAccessException
- if there was an error accessing
the definition of the component class.<T> T getInjectableInstance(T instance)
If the injectable instance is the same as the instance that was passed in then the provider MUST return that instance.
T
- the type to inject.instance
- the instance returned by one of the getInstance methods.
void inject(java.lang.Object instance)
instance
- the instance to perform injection on.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |