Module org.glassfish.hk2.api
Interface NamedBindingBuilder<T>
- Type Parameters:
T- service type.
- All Superinterfaces:
BindingBuilder<T>
Named service binding builder.
- Author:
- Marek Potociar (marek.potociar at oracle.com)
-
Method Summary
Modifier and TypeMethodDescriptionCall this if the parameterized type of the implementation class is known.in(Class<? extends Annotation> scopeAnnotation) Scope a binding.Custom HK2 loader to be used when service class is about to be loaded.proxy(boolean proxiable) Set proxy flag on the binding.qualifiedBy(Annotation annotation) Add a binging qualifier annotation.voidranked(int rank) Rank the binding.Bind a new contract to a service.to(TypeLiteral<?> contract) Bind a new contract to a service.withMetadata(String key, String value) Add binding descriptor metadata.withMetadata(String key, List<String> values) Add binding descriptor metadata.
-
Method Details
-
to
Bind a new contract to a service.- Parameters:
contract- contract type.- Returns:
- updated binder.
-
to
Bind a new contract to a service.- Parameters:
contract- contract type.- Returns:
- updated binder.
-
loadedBy
Custom HK2 loader to be used when service class is about to be loaded.- Parameters:
loader- custom service loader.- Returns:
- updated binder.
-
withMetadata
Add binding descriptor metadata. The metadata can be later used to e.g.filterbinding descriptors. If this is forFactorydescriptors the metadata will be placed on both the Factory as a service and on the FactoriesFactory.provide()method- Parameters:
key- metadata key.value- metadata value.- Returns:
- updated binder.
-
withMetadata
Add binding descriptor metadata. The metadata can be later used to e.g.filterbinding descriptors. If this is forFactorydescriptors the metadata will be placed on both the Factory as a service and on the FactoriesFactory.provide()method- Parameters:
key- metadata key.values- metadata values.- Returns:
- updated binder.
-
qualifiedBy
Add a binging qualifier annotation. If this is being used with aFactorythen both the Factory Service and theFactory.provide()method will get the qualifier- Parameters:
annotation- qualifier annotation.- Returns:
- updated binder.
-
in
Scope a binding.- Parameters:
scopeAnnotation- scope annotation.- Returns:
- updated binding.
-
ranked
void ranked(int rank) Rank the binding. The higher rank, the more prominent position in an injectediterable providerfor a contract.- Parameters:
rank- binding rank to be used to resolve ordering in case of multiple services are bound to the same contract.
-
proxy
Set proxy flag on the binding.- Parameters:
proxiable- flag to determine if the binding should be proxiable.
-
asType
Call this if the parameterized type of the implementation class is known. This must only be called with a ParameterizedType- Parameters:
t- The non-null ParameterizedType describing the implementation- Returns:
- A DescriptorBuilder with the given implementationType
-