|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BinderFactory
Factory for adding services instances to a Services. Services
definition can vary per service, some services implement well defined
interfaces usually annotated with Contract
which are called contracts. Some services do not implement such
interfaces and are registered under their implementation type.
When registering services using this programmatic API, it is not
necessary to use the HK2 annotations. Optional presence of such
annotations will be ignored when registering servics.
| Method Summary | ||
|---|---|---|
NamedBinder<java.lang.Object> |
bind()
Binds a service which does not implement a contract or interface that can be used to look it up. |
|
|
bind(java.lang.Class<T> contract,
java.lang.Class<?>... contracts)
Starts a binding process of a service using at least one interface or abstract class Class reference. |
|
Binder<java.lang.Object> |
bind(java.lang.String... contractNames)
Starts the binding process of a service using String
interfaces names that can be used to lookup the service. |
|
Binder<java.lang.Object> |
bind(java.lang.String contractName)
Binds a service using a String interface name. |
|
|
bind(TypeLiteral<T> typeLiteral)
Binds a parameterized type by forcing users to create a subclass of TypeLiteral which will allow HK2 to retrieve the parameterized
type at runtime. |
|
BinderFactory |
inParent()
Return the parent binder factory instance which can be used to bind services for wider visibility outside of this module definition. |
|
| Method Detail |
|---|
BinderFactory inParent()
Binder<java.lang.Object> bind(java.lang.String contractName)
String interface name.
contractName - the interface fqcn.
Binder instance that can be used to further
qualify the binding request.Binder<java.lang.Object> bind(java.lang.String... contractNames)
String
interfaces names that can be used to lookup the service.
contractNames - the interfaces fully qualified class names.
Binder instance that can be used to further
qualify the binding request.
<T> Binder<T> bind(java.lang.Class<T> contract,
java.lang.Class<?>... contracts)
Class reference.
Supplemental interfaces can be used to register the service
under different contracts. Each contract can be used to look
up the service.
The service must implements all the contracts passed in
this method.
T - the main contract typecontract - the main contract Class referencecontracts - supplemental contracts references
Binder instance for the main contract type type to further
qualify the binding request.<T> Binder<T> bind(TypeLiteral<T> typeLiteral)
TypeLiteral which will allow HK2 to retrieve the parameterized
type at runtime.
T - the parameterized type to use as a contract definition. This
will allow users to inject instances of the parameterized type. HK2
cannot bind a generic type like SettypeLiteral - a TypeLiteral subclass instance
Binder instance for that parameterized type to further
qualify the binding request.NamedBinder<java.lang.Object> bind()
NamedBinder to register the service.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||