public class ActiveDescriptorBuilderImpl extends java.lang.Object implements ActiveDescriptorBuilder
Modifier and Type | Class and Description |
---|---|
private static class |
ActiveDescriptorBuilderImpl.BuiltActiveDescriptor<T> |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
classAnalysisName |
private java.util.HashSet<java.lang.reflect.Type> |
contracts |
private java.lang.Class<?> |
implementation |
private java.lang.reflect.Type |
implementationType |
private HK2Loader |
loader |
private java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> |
metadatas |
private java.lang.String |
name |
private java.lang.Boolean |
proxy |
private java.lang.Boolean |
proxyForSameScope |
private java.util.HashSet<java.lang.annotation.Annotation> |
qualifiers |
private int |
rank |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
scope |
private java.lang.annotation.Annotation |
scopeAnnotation |
private DescriptorVisibility |
visibility |
Constructor and Description |
---|
ActiveDescriptorBuilderImpl(java.lang.Class<?> implementation)
constructor with the impl class
|
Modifier and Type | Method and Description |
---|---|
ActiveDescriptorBuilder |
analyzeWith(java.lang.String serviceName)
Call this if the descriptor should be analyzed with the
ClassAnalyzer service of the given name |
ActiveDescriptorBuilder |
andLoadWith(HK2Loader loader)
Call this if this descriptor should be loaded with the given HK2Loader
|
ActiveDescriptorBuilder |
asType(java.lang.reflect.Type t)
Call this if the parameterized type of the implementation
class is known.
|
<T> AbstractActiveDescriptor<T> |
build()
Generates a descriptor that can be used in binding operations
|
<T> AbstractActiveDescriptor<T> |
buildFactory()
Deprecated.
|
<T> AbstractActiveDescriptor<T> |
buildProvideMethod()
Generates a descriptor that can be used in binding operations that
describes a factorys provide method
|
ActiveDescriptorBuilder |
has(java.lang.String key,
java.util.List<java.lang.String> values)
An instance of data to be associated with this descriptor
|
ActiveDescriptorBuilder |
has(java.lang.String key,
java.lang.String value)
An instance of data to be associated with this descriptor
|
ActiveDescriptorBuilder |
in(java.lang.annotation.Annotation scopeAnnotation)
A scope to be associated with this descriptor object.
|
ActiveDescriptorBuilder |
in(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
A scope to be associated with this descriptor object.
|
ActiveDescriptorBuilder |
localOnly()
This will cause the descriptorVisibility field of the returned
descriptor to return LOCAL
|
ActiveDescriptorBuilder |
named(java.lang.String name)
The name for this descriptor object.
|
ActiveDescriptorBuilder |
ofRank(int rank)
The rank to be associated with this descriptor.
|
ActiveDescriptorBuilder |
proxy()
This will cause the isProxiable field of the returned
descriptor to return true (it will force this
descriptor to use proxies).
|
ActiveDescriptorBuilder |
proxy(boolean forceProxy)
This will cause the isProxiable field of the returned
descriptor to return the given value.
|
ActiveDescriptorBuilder |
proxyForSameScope()
This will cause the isProxyForSameScope field of the returned
descriptor to return true (it will force this
descriptor to use proxies even when injecting into
the same scope).
|
ActiveDescriptorBuilder |
proxyForSameScope(boolean forceProxyForSameScope)
This will cause the isProxyForSameScope field of the returned
descriptor to return the given value.
|
ActiveDescriptorBuilder |
qualifiedBy(java.lang.annotation.Annotation annotation)
A qualifier to be associated with this descriptor object
|
ActiveDescriptorBuilder |
to(java.lang.reflect.Type contract)
A contract to be associated with this descriptor object.
|
ActiveDescriptorBuilder |
visibility(DescriptorVisibility visibility)
This will set the descriptorVisibility field of the returned
descriptor
|
private java.lang.String name
private final java.util.HashSet<java.lang.reflect.Type> contracts
private java.lang.annotation.Annotation scopeAnnotation
private java.lang.Class<? extends java.lang.annotation.Annotation> scope
private final java.util.HashSet<java.lang.annotation.Annotation> qualifiers
private final java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> metadatas
private final java.lang.Class<?> implementation
private HK2Loader loader
private int rank
private java.lang.Boolean proxy
private java.lang.Boolean proxyForSameScope
private DescriptorVisibility visibility
private java.lang.String classAnalysisName
private java.lang.reflect.Type implementationType
public ActiveDescriptorBuilderImpl(java.lang.Class<?> implementation)
implementation
- The implementation class (may be null)public ActiveDescriptorBuilder named(java.lang.String name) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
named
in interface ActiveDescriptorBuilder
name
- The name to be associated with this Descriptorjava.lang.IllegalArgumentException
- if there is more than one name on the predicatepublic ActiveDescriptorBuilder to(java.lang.reflect.Type contract) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
to
in interface ActiveDescriptorBuilder
contract
- A class that is annotated with Contract to
be associated with this Descriptorjava.lang.IllegalArgumentException
- on failurespublic ActiveDescriptorBuilder in(java.lang.annotation.Annotation scopeAnnotation) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
in
in interface ActiveDescriptorBuilder
scopeAnnotation
- The class of the scope this descriptor is to have.java.lang.IllegalArgumentException
- If in is called more than oncepublic ActiveDescriptorBuilder in(java.lang.Class<? extends java.lang.annotation.Annotation> scope) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
in
in interface ActiveDescriptorBuilder
scope
- The class of the scope this descriptor is to have.java.lang.IllegalArgumentException
- If in is called more than oncepublic ActiveDescriptorBuilder qualifiedBy(java.lang.annotation.Annotation annotation) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
qualifiedBy
in interface ActiveDescriptorBuilder
annotation
- The annotation to be associated with this descriptorjava.lang.IllegalArgumentException
- on failurespublic ActiveDescriptorBuilder has(java.lang.String key, java.lang.String value) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
has
in interface ActiveDescriptorBuilder
key
- The key for the data to be associated with this descriptorvalue
- The value this key should take (single value metadata)java.lang.IllegalArgumentException
public ActiveDescriptorBuilder has(java.lang.String key, java.util.List<java.lang.String> values) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
has
in interface ActiveDescriptorBuilder
key
- The key for the data to be associated with this descriptorvalues
- The values this key should take (single value metadata)java.lang.IllegalArgumentException
public ActiveDescriptorBuilder ofRank(int rank)
ActiveDescriptorBuilder
ofRank
in interface ActiveDescriptorBuilder
rank
- The rank to be associated with this descriptor.public ActiveDescriptorBuilder proxy()
ActiveDescriptorBuilder
proxy
in interface ActiveDescriptorBuilder
public ActiveDescriptorBuilder proxy(boolean forceProxy)
ActiveDescriptorBuilder
proxy
in interface ActiveDescriptorBuilder
forceProxy
- if true then this descriptor will be proxied,
if false then this descriptor will NOT be proxiedpublic ActiveDescriptorBuilder proxyForSameScope()
ActiveDescriptorBuilder
proxyForSameScope
in interface ActiveDescriptorBuilder
public ActiveDescriptorBuilder proxyForSameScope(boolean forceProxyForSameScope)
ActiveDescriptorBuilder
proxyForSameScope
in interface ActiveDescriptorBuilder
forceProxyForSameScope
- if true then this descriptor will be
proxied even if the scope of the injectee is the same,
if false then this descriptor will NOT be proxied, even if the
scope of the injectee is the samepublic ActiveDescriptorBuilder andLoadWith(HK2Loader loader) throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
andLoadWith
in interface ActiveDescriptorBuilder
loader
- The loader to use with this descriptorjava.lang.IllegalArgumentException
- if the HK2Loader is set non-null more than oncepublic ActiveDescriptorBuilder analyzeWith(java.lang.String serviceName)
ActiveDescriptorBuilder
ClassAnalyzer
service of the given nameanalyzeWith
in interface ActiveDescriptorBuilder
serviceName
- the name of the ClassAnalyzer
service
that should be used to analyze this servicepublic ActiveDescriptorBuilder localOnly()
ActiveDescriptorBuilder
localOnly
in interface ActiveDescriptorBuilder
public ActiveDescriptorBuilder visibility(DescriptorVisibility visibility)
ActiveDescriptorBuilder
visibility
in interface ActiveDescriptorBuilder
visibility
- The non-null visibility that this descriptor should takepublic ActiveDescriptorBuilder asType(java.lang.reflect.Type t)
ActiveDescriptorBuilder
asType
in interface ActiveDescriptorBuilder
t
- The non-null ParameterizedType describing the implementationpublic <T> AbstractActiveDescriptor<T> build() throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
build
in interface ActiveDescriptorBuilder
java.lang.IllegalArgumentException
- if the built descriptor is invalid@Deprecated public <T> AbstractActiveDescriptor<T> buildFactory() throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
buildFactory
in interface ActiveDescriptorBuilder
java.lang.IllegalArgumentException
- if the built descriptor is invalidpublic <T> AbstractActiveDescriptor<T> buildProvideMethod() throws java.lang.IllegalArgumentException
ActiveDescriptorBuilder
buildProvideMethod
in interface ActiveDescriptorBuilder
java.lang.IllegalArgumentException
- if the built descriptor is invalid