public class DescriptorBuilderImpl extends Object implements DescriptorBuilder
DescriptorBuilder| Constructor and Description |
|---|
DescriptorBuilderImpl()
The basid constructor
|
DescriptorBuilderImpl(String implementation,
boolean addToContracts)
A descriptor builder with the given implementation
|
| Modifier and Type | Method and Description |
|---|---|
DescriptorBuilder |
analyzeWith(String serviceName)
Call this if the descriptor should be analyzed with the
ClassAnalyzer service of the given name |
DescriptorBuilder |
andLoadWith(HK2Loader loader)
Call this if this descriptor should be loaded with the given HK2Loader
|
DescriptorImpl |
build()
Generates a descriptor that can be used in binding operations
|
FactoryDescriptors |
buildFactory()
Generates a factory descriptor that can be used in binding operations.
|
FactoryDescriptors |
buildFactory(Class<? extends Annotation> factoryScope)
Generates a factory descriptor that can be used in binding operations.
|
FactoryDescriptors |
buildFactory(String factoryScope)
Generates a factory descriptor that can be used in binding operations.
|
DescriptorBuilder |
has(String key,
List<String> values)
An instance of data to be associated with this descriptor
|
DescriptorBuilder |
has(String key,
String value)
An instance of data to be associated with this descriptor
|
DescriptorBuilder |
in(Class<? extends Annotation> scope)
A scope to be associated with this descriptor object.
|
DescriptorBuilder |
in(String scope)
A scope to be associated with this descriptor object.
|
DescriptorBuilder |
localOnly()
This will cause the descriptorVisibility field of the returned
descriptor to return LOCAL
|
DescriptorBuilder |
named(String name)
The name for this descriptor object.
|
DescriptorBuilder |
ofRank(int rank)
The rank to be associated with this descriptor.
|
DescriptorBuilder |
proxy()
This will cause the isProxiable field of the returned
descriptor to return true (it will force this
descriptor to use proxies).
|
DescriptorBuilder |
proxy(boolean forceProxy)
This will cause the isProxiable field of the returned
descriptor to return the given value.
|
DescriptorBuilder |
proxyForSameScope()
This will cause the isProxyForSameScope field of the returned
descriptor to return true (it will force this
descriptor to proxy even when injecting into the same scope).
|
DescriptorBuilder |
proxyForSameScope(boolean proxyForSameScope)
This will cause the isProxyForSameScope field of the returned
descriptor to return the given value.
|
DescriptorBuilder |
qualifiedBy(Annotation annotation)
A qualifier to be associated with this descriptor object.
|
DescriptorBuilder |
qualifiedBy(String annotation)
A qualifier to be associated with this descriptor object
|
DescriptorBuilder |
to(Class<?> contract)
A contract to be associated with this descriptor object.
|
DescriptorBuilder |
to(String contract)
A contract to be associated with this descriptor object.
|
DescriptorBuilder |
visibility(DescriptorVisibility visibility)
This will set the descriptorVisibility field of the returned
descriptor
|
public DescriptorBuilderImpl()
public DescriptorBuilderImpl(String implementation, boolean addToContracts)
implementation - The implementation this should takeaddToContracts - Whether or not to add the implementation to the set of
contractspublic DescriptorBuilder named(String name) throws IllegalArgumentException
DescriptorBuildernamed in interface DescriptorBuildername - The name to be associated with this DescriptorIllegalArgumentException - if there is more than one name on the predicatepublic DescriptorBuilder to(Class<?> contract) throws IllegalArgumentException
DescriptorBuilderto in interface DescriptorBuildercontract - A class that is annotated with Contract to
be associated with this DescriptorIllegalArgumentException - on failurespublic DescriptorBuilder to(String contract) throws IllegalArgumentException
DescriptorBuilderto in interface DescriptorBuildercontract - The fully qualified name of a class that is annotated with Contract.IllegalArgumentException - on failurespublic DescriptorBuilder in(Class<? extends Annotation> scope) throws IllegalArgumentException
DescriptorBuilderin in interface DescriptorBuilderscope - The class of the scope this descriptor is to have.IllegalArgumentException - If in is called more than oncepublic DescriptorBuilder in(String scope) throws IllegalArgumentException
DescriptorBuilderin in interface DescriptorBuilderscope - The fully qualified class name of the scope this predicate is to have.IllegalArgumentException - If in is called more than oncepublic DescriptorBuilder qualifiedBy(Annotation annotation) throws IllegalArgumentException
DescriptorBuilderDescriptor.
Use this method with care and ONLY with annotations that do
not have fields. A safe version of this method for use
with ghost annotations is
ActiveDescriptorBuilder.qualifiedBy(Annotation)qualifiedBy in interface DescriptorBuilderannotation - The annotation to be associated with this descriptorIllegalArgumentException - on failurespublic DescriptorBuilder qualifiedBy(String annotation) throws IllegalArgumentException
DescriptorBuilderqualifiedBy in interface DescriptorBuilderannotation - The fully qualified class name of an annotation to be
associated with this descriptorIllegalArgumentException - on failurespublic DescriptorBuilder has(String key, String value) throws IllegalArgumentException
DescriptorBuilderhas in interface DescriptorBuilderkey - The key for the data to be associated with this descriptorvalue - The value this key should take (single value metadata)IllegalArgumentExceptionpublic DescriptorBuilder has(String key, List<String> values) throws IllegalArgumentException
DescriptorBuilderhas in interface DescriptorBuilderkey - The key for the data to be associated with this descriptorvalues - The values this key should take (single value metadata)IllegalArgumentExceptionpublic DescriptorBuilder ofRank(int rank)
DescriptorBuilderofRank in interface DescriptorBuilderrank - The rank to be associated with this descriptor.public DescriptorBuilder proxy()
DescriptorBuilderproxy in interface DescriptorBuilderpublic DescriptorBuilder proxy(boolean forceProxy)
DescriptorBuilderproxy in interface DescriptorBuilderforceProxy - if true then this descriptor will be proxied,
if false then this descriptor will NOT be proxiedpublic DescriptorBuilder proxyForSameScope()
DescriptorBuilderproxyForSameScope in interface DescriptorBuilderpublic DescriptorBuilder proxyForSameScope(boolean proxyForSameScope)
DescriptorBuilderproxyForSameScope in interface DescriptorBuilderproxyForSameScope - if true then this descriptor will be proxied
even when being injected into the same scope,
if false then this descriptor will NOT be proxied when injected
into a service of the same scopepublic DescriptorBuilder localOnly()
DescriptorBuilderlocalOnly in interface DescriptorBuilderpublic DescriptorBuilder visibility(DescriptorVisibility visibility)
DescriptorBuildervisibility in interface DescriptorBuildervisibility - The non-null visibility that this descriptor should takepublic DescriptorBuilder andLoadWith(HK2Loader loader) throws IllegalArgumentException
DescriptorBuilderandLoadWith in interface DescriptorBuilderloader - The loader to use with this descriptorIllegalArgumentException - if the HK2Loader is set non-null more than oncepublic DescriptorBuilder analyzeWith(String serviceName)
DescriptorBuilderClassAnalyzer service of the given nameanalyzeWith in interface DescriptorBuilderserviceName - the name of the ClassAnalyzer service
that should be used to analyze this servicepublic DescriptorImpl build() throws IllegalArgumentException
DescriptorBuilderbuild in interface DescriptorBuilderIllegalArgumentException - if the built descriptor is invalidpublic FactoryDescriptors buildFactory(String factoryScope) throws IllegalArgumentException
DescriptorBuilderbuildFactory in interface DescriptorBuilderfactoryScope - The scope the factory service itself is in.IllegalArgumentException - if the built descriptor is invalidpublic FactoryDescriptors buildFactory() throws IllegalArgumentException
DescriptorBuilderbuildFactory in interface DescriptorBuilderIllegalArgumentException - if the built descriptor is invalidpublic FactoryDescriptors buildFactory(Class<? extends Annotation> factoryScope) throws IllegalArgumentException
DescriptorBuilderbuildFactory in interface DescriptorBuilderfactoryScope - The scope the factory service itself is in. If this is null the
PerLookup scope will be usedIllegalArgumentException - if the built descriptor is invalidCopyright © 2009–2019 Oracle Corporation. All rights reserved.