|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Deprecated public interface Factory<T>
Provides an instance of T either by creating a new one at each request or by returning an existing one.
Factories are used in a wide variety of ways in HK2:NamedBinder.toFactory(Factory)
. this factory
is called at runtime whenever a consumer locates this factory provider
and attempts to use it.
The Scope
of services it produces is ultimately determined by
how the implementation behaves when asked to provide service instances
to the consumer (i.e., the factory methods are invoked on it).
HK2 uses Factories internally:
get()
regardless of the caller context.
Scope
, HK2 will return
the same service globally for every request made.
Releasable.release()
will not be
invoked on a PerLookup scoped service. A Dependent service in
JSR-330/299, on the other hand, will be released when its parent
component/service/bean is released (i.e., goes out of scope).
Method Summary | |
---|---|
T |
get()
Deprecated. The system calls this method to obtain a reference to the component/service. |
Method Detail |
---|
T get() throws ComponentException
ComponentException
- If the factory failed to get/create an instance
and would like to propagate the error to the caller.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |