|
||||||||||
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.
A ComponentProvider
instance may be registed by passing the
instance to the
WebApplication.initiate(com.sun.ws.rest.api.core.ResourceConfig, ComponentProvider)
method.
Applications may extend the ServletContainer
and override the method ServletContainer.initiate(ResourceConfig, WebApplication)
to initiate the WebApplication
with the ComponentProvider
instance.
WebApplication
,
ServletContainer
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 JAX-RS and Jersey specific instances on to fields. |
|
|
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
scope
- the scope of the instancec
- the class
java.lang.InstantiationException
java.lang.IllegalAccessException
<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.
scope
- the scope of the instancecontructor
- the constructor to instantiate the classparameters
- the array parameter values passed to the constructor
java.lang.InstantiationException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
<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.
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 |