org.glassfish.hk2
Interface BinderFactory

All Known Subinterfaces:
DynamicBinderFactory

Deprecated.

@Deprecated
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.

Important Note: A new binding is completed only after calling one of the "to*(...)" methods of NamedBinder.

Author:
Jerome Dochez, Jeff Trent

Method Summary
 NamedBinder<Object> bind()
          Deprecated. Binds a service which does not implement a contract or interface that can be used to look it up.
<T> Binder<T>
bind(Class<T> contract, Class<?>... contracts)
          Deprecated. Starts a binding process of a service using at least one interface or abstract class Class reference.
 Binder<Object> bind(String... contractNames)
          Deprecated. Starts the binding process of a service using String interfaces names that can be used to lookup the service.
 Binder<Object> bind(String contractName)
          Deprecated. Binds a service using a String interface name.
<T> Binder<T>
bind(TypeLiteral<T> typeLiteral)
          Deprecated. 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()
          Deprecated. Return the parent binder factory instance which can be used to bind services for wider visibility outside of this module definition.
 

Method Detail

inParent

BinderFactory inParent()
Deprecated. 
Return the parent binder factory instance which can be used to bind services for wider visibility outside of this module definition.

Returns:
the parent binder factory or null if there is no parent.

bind

Binder<Object> bind(String contractName)
Deprecated. 
Binds a service using a String interface name.

Parameters:
contractName - the interface fqcn.
Returns:
a Binder instance that can be used to further qualify the binding request.

bind

Binder<Object> bind(String... contractNames)
Deprecated. 
Starts the binding process of a service using String interfaces names that can be used to lookup the service.

Parameters:
contractNames - the interfaces fully qualified class names.
Returns:
a Binder instance that can be used to further qualify the binding request.

bind

<T> Binder<T> bind(Class<T> contract,
                   Class<?>... contracts)
Deprecated. 
Starts a binding process of a service using at least one interface or abstract class 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.

Type Parameters:
T - the main contract type
Parameters:
contract - the main contract Class reference
contracts - supplemental contracts references
Returns:
a Binder instance for the main contract type type to further qualify the binding request.

bind

<T> Binder<T> bind(TypeLiteral<T> typeLiteral)
Deprecated. 
Binds a parameterized type by forcing users to create a subclass of TypeLiteral which will allow HK2 to retrieve the parameterized type at runtime.

Type Parameters:
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 Set although it can injects it as long as E is specified at the injection point and the parameterized type can be looked up.
Parameters:
typeLiteral - a TypeLiteral subclass instance
Returns:
a Binder instance for that parameterized type to further qualify the binding request.

bind

NamedBinder<Object> bind()
Deprecated. 
Binds a service which does not implement a contract or interface that can be used to look it up. The bound service can only be looked up using the service type directly. A service registered by its type cannot be named.

Returns:
a NamedBinder to register the service.


Copyright © 2013 Oracle Corporation. All Rights Reserved.