Top Description Methods
org.glassfish.hk2.utilities.binding

public Interface ScopedNamedBindingBuilder<T>

extends BindingBuilder<T>
Known Direct Implementers
org.glassfish.hk2.utilities.binding.AbstractBindingBuilder
Type Parameters
<T>
service type.
Imports
java.lang.annotation.Annotation, java.util.List, org.glassfish.hk2.api.HK2Loader, .TypeLiteral

Scoped and named service binding builder.
Author
Marek Potociar (marek.potociar at oracle.com)

Method Summary

Modifier and TypeMethod and Description
public ScopedNamedBindingBuilder<T>
analyzeWith(String
The name of the analyzer that should be used. May be null to indicate the default class analzyer
analyzer
)

Set the name of the org.glassfish.hk2.api.ClassAnalyzer on the binding.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
loadedBy
(HK2Loader
custom service loader.
loader
)

Custom HK2 loader to be used when service class is about to be loaded.

public ScopedNamedBindingBuilder<T>
proxy(boolean
flag to determine if the binding should be proxiable.
proxiable
)

Set proxy flag on the binding.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
qualifiedBy
(Annotation
qualifier annotation.
annotation
)

Add a binging qualifier annotation.

public void
ranked(int
binding rank to be used to resolve ordering in case of multiple services are bound to the same contract.
rank
)

Rank the binding.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
to
(Class<? super T>
contract type.
contract
)

Bind a new contract to a service.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
to
(TypeLiteral<?>
contract type.
contract
)

Bind a new contract to a service.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
withMetadata
(String
metadata key.
key
,
String
metadata value.
value
)

Add binding descriptor metadata.

public ScopedNamedBindingBuilder<T>

Returns:

updated binder.
withMetadata
(String
metadata key.
key
,
List<String>
metadata values.
values
)

Add binding descriptor metadata.

Method Detail

analyzeWithback to summary
public ScopedNamedBindingBuilder<T> analyzeWith(String analyzer)

Set the name of the org.glassfish.hk2.api.ClassAnalyzer on the binding.

Parameters
analyzer:String

The name of the analyzer that should be used. May be null to indicate the default class analzyer

loadedByback to summary
public ScopedNamedBindingBuilder<T> loadedBy(HK2Loader loader)

Custom HK2 loader to be used when service class is about to be loaded.

Parameters
loader:HK2Loader

custom service loader.

Returns:ScopedNamedBindingBuilder<T>

updated binder.

proxyback to summary
public ScopedNamedBindingBuilder<T> proxy(boolean proxiable)

Set proxy flag on the binding.

Parameters
proxiable:boolean

flag to determine if the binding should be proxiable.

qualifiedByback to summary
public ScopedNamedBindingBuilder<T> qualifiedBy(Annotation annotation)

Add a binging qualifier annotation. If this is being used with a org.glassfish.hk2.api.Factory then both the Factory Service and the org.glassfish.hk2.api.Factory#provide() method will get the qualifier

Parameters
annotation:Annotation

qualifier annotation.

Returns:ScopedNamedBindingBuilder<T>

updated binder.

rankedback to summary
public void ranked(int rank)

Rank the binding. The higher rank, the more prominent position in an injected iterable provider for a contract.

Parameters
rank:int

binding rank to be used to resolve ordering in case of multiple services are bound to the same contract.

toback to summary
public ScopedNamedBindingBuilder<T> to(Class<? super T> contract)

Bind a new contract to a service.

Parameters
contract:Class<? super T>

contract type.

Returns:ScopedNamedBindingBuilder<T>

updated binder.

toback to summary
public ScopedNamedBindingBuilder<T> to(TypeLiteral<?> contract)

Bind a new contract to a service.

Parameters
contract:TypeLiteral<?>

contract type.

Returns:ScopedNamedBindingBuilder<T>

updated binder.

withMetadataback to summary
public ScopedNamedBindingBuilder<T> withMetadata(String key, String value)

Add binding descriptor metadata.

The metadata can be later used to e.g. filter binding descriptors. If this is for org.glassfish.hk2.api.Factory descriptors the metadata will be placed on both the Factory as a service and on the Factories org.glassfish.hk2.api.Factory#provide() method

Parameters
key:String

metadata key.

value:String

metadata value.

Returns:ScopedNamedBindingBuilder<T>

updated binder.

withMetadataback to summary
public ScopedNamedBindingBuilder<T> withMetadata(String key, List<String> values)

Add binding descriptor metadata. The metadata can be later used to e.g. filter binding descriptors. If this is for org.glassfish.hk2.api.Factory descriptors the metadata will be placed on both the Factory as a service and on the Factories org.glassfish.hk2.api.Factory#provide() method

Parameters
key:String

metadata key.

values:List<String>

metadata values.

Returns:ScopedNamedBindingBuilder<T>

updated binder.