Package org.glassfish.hk2.internal
Class ActiveDescriptorBuilderImpl
java.lang.Object
org.glassfish.hk2.internal.ActiveDescriptorBuilderImpl
- All Implemented Interfaces:
ActiveDescriptorBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private final Class
<?> private Type
private HK2Loader
private String
private Boolean
private Boolean
private final HashSet
<Annotation> private int
private Class
<? extends Annotation> private Annotation
private DescriptorVisibility
-
Constructor Summary
ConstructorsConstructorDescriptionActiveDescriptorBuilderImpl
(Class<?> implementation) constructor with the impl class -
Method Summary
Modifier and TypeMethodDescriptionanalyzeWith
(String serviceName) Call this if the descriptor should be analyzed with theClassAnalyzer
service of the given nameandLoadWith
(HK2Loader loader) Call this if this descriptor should be loaded with the given HK2LoaderCall 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> Deprecated.<T> AbstractActiveDescriptor
<T> Generates a descriptor that can be used in binding operations that describes a factorys provide methodAn instance of data to be associated with this descriptorAn instance of data to be associated with this descriptorin
(Annotation scopeAnnotation) A scope to be associated with this descriptor object.in
(Class<? extends Annotation> scope) A scope to be associated with this descriptor object.This will cause the descriptorVisibility field of the returned descriptor to return LOCALThe name for this descriptor object.ofRank
(int rank) The rank to be associated with this descriptor.proxy()
This will cause the isProxiable field of the returned descriptor to return true (it will force this descriptor to use proxies).proxy
(boolean forceProxy) This will cause the isProxiable field of the returned descriptor to return the given value.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).proxyForSameScope
(boolean forceProxyForSameScope) This will cause the isProxyForSameScope field of the returned descriptor to return the given value.qualifiedBy
(Annotation annotation) A qualifier to be associated with this descriptor objectA contract to be associated with this descriptor object.visibility
(DescriptorVisibility visibility) This will set the descriptorVisibility field of the returned descriptor
-
Field Details
-
name
-
contracts
-
scopeAnnotation
-
scope
-
qualifiers
-
metadatas
-
implementation
-
loader
-
rank
private int rank -
proxy
-
proxyForSameScope
-
visibility
-
classAnalysisName
-
implementationType
-
-
Constructor Details
-
ActiveDescriptorBuilderImpl
constructor with the impl class- Parameters:
implementation
- The implementation class (may be null)
-
-
Method Details
-
named
Description copied from interface:ActiveDescriptorBuilder
The name for this descriptor object. Note that at the current time a descriptor can only have one name, hence this method will throw an IllegalArgumentException if named is called more than once.- Specified by:
named
in interfaceActiveDescriptorBuilder
- Parameters:
name
- The name to be associated with this Descriptor- Returns:
- A DescriptorBuilder with the given name
- Throws:
IllegalArgumentException
- if there is more than one name on the predicate
-
to
Description copied from interface:ActiveDescriptorBuilder
A contract to be associated with this descriptor object.- Specified by:
to
in interfaceActiveDescriptorBuilder
- Parameters:
contract
- A class that is annotated with Contract to be associated with this Descriptor- Returns:
- A DescriptorBuilder with the given name
- Throws:
IllegalArgumentException
- on failures
-
in
Description copied from interface:ActiveDescriptorBuilder
A scope to be associated with this descriptor object. Note that at the current time a descriptor can only have one scope, hence this method will throw an IllegalArgumentException if in is called more than once.- Specified by:
in
in interfaceActiveDescriptorBuilder
- Parameters:
scopeAnnotation
- The class of the scope this descriptor is to have.- Returns:
- A DescriptorBuilder with the given scope
- Throws:
IllegalArgumentException
- If in is called more than once
-
in
public ActiveDescriptorBuilder in(Class<? extends Annotation> scope) throws IllegalArgumentException Description copied from interface:ActiveDescriptorBuilder
A scope to be associated with this descriptor object. Note that at the current time a descriptor can only have one scope, hence this method will throw an IllegalArgumentException if in is called more than once.- Specified by:
in
in interfaceActiveDescriptorBuilder
- Parameters:
scope
- The class of the scope this descriptor is to have.- Returns:
- A DescriptorBuilder with the given scope
- Throws:
IllegalArgumentException
- If in is called more than once
-
qualifiedBy
Description copied from interface:ActiveDescriptorBuilder
A qualifier to be associated with this descriptor object- Specified by:
qualifiedBy
in interfaceActiveDescriptorBuilder
- Parameters:
annotation
- The annotation to be associated with this descriptor- Returns:
- A DescriptorBuilder with the given annotation
- Throws:
IllegalArgumentException
- on failures
-
has
Description copied from interface:ActiveDescriptorBuilder
An instance of data to be associated with this descriptor- Specified by:
has
in interfaceActiveDescriptorBuilder
- Parameters:
key
- The key for the data to be associated with this descriptorvalue
- The value this key should take (single value metadata)- Returns:
- A DescriptorBuilder with the given metadata
- Throws:
IllegalArgumentException
-
has
Description copied from interface:ActiveDescriptorBuilder
An instance of data to be associated with this descriptor- Specified by:
has
in interfaceActiveDescriptorBuilder
- Parameters:
key
- The key for the data to be associated with this descriptorvalues
- The values this key should take (single value metadata)- Returns:
- A DescriptorBuilder with the given metadata
- Throws:
IllegalArgumentException
-
ofRank
Description copied from interface:ActiveDescriptorBuilder
The rank to be associated with this descriptor. The last rank bound wins- Specified by:
ofRank
in interfaceActiveDescriptorBuilder
- Parameters:
rank
- The rank to be associated with this descriptor.- Returns:
- A DescriptorBuilder with the given rank
-
proxy
Description copied from interface:ActiveDescriptorBuilder
This will cause the isProxiable field of the returned descriptor to return true (it will force this descriptor to use proxies).- Specified by:
proxy
in interfaceActiveDescriptorBuilder
- Returns:
- A DescriptorBuilder with the proxiable field set to true
-
proxy
Description copied from interface:ActiveDescriptorBuilder
This will cause the isProxiable field of the returned descriptor to return the given value.- Specified by:
proxy
in interfaceActiveDescriptorBuilder
- Parameters:
forceProxy
- if true then this descriptor will be proxied, if false then this descriptor will NOT be proxied- Returns:
- A DescriptorBuilder with the proxiable field set to the given value
-
proxyForSameScope
Description copied from interface:ActiveDescriptorBuilder
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).- Specified by:
proxyForSameScope
in interfaceActiveDescriptorBuilder
- Returns:
- A DescriptorBuilder with the proxyForSameScope field set to true
-
proxyForSameScope
Description copied from interface:ActiveDescriptorBuilder
This will cause the isProxyForSameScope field of the returned descriptor to return the given value.- Specified by:
proxyForSameScope
in interfaceActiveDescriptorBuilder
- Parameters:
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 same- Returns:
- A DescriptorBuilder with the proxyForSameScope field set to the given value
-
andLoadWith
Description copied from interface:ActiveDescriptorBuilder
Call this if this descriptor should be loaded with the given HK2Loader- Specified by:
andLoadWith
in interfaceActiveDescriptorBuilder
- Parameters:
loader
- The loader to use with this descriptor- Returns:
- A DescriptorBuilder with the given HK2Loader
- Throws:
IllegalArgumentException
- if the HK2Loader is set non-null more than once
-
analyzeWith
Description copied from interface:ActiveDescriptorBuilder
Call this if the descriptor should be analyzed with theClassAnalyzer
service of the given name- Specified by:
analyzeWith
in interfaceActiveDescriptorBuilder
- Parameters:
serviceName
- the name of theClassAnalyzer
service that should be used to analyze this service- Returns:
- A DescriptorBuilder with the given analysis service
-
localOnly
Description copied from interface:ActiveDescriptorBuilder
This will cause the descriptorVisibility field of the returned descriptor to return LOCAL- Specified by:
localOnly
in interfaceActiveDescriptorBuilder
- Returns:
- A DescriptorBuilder with the descriptorVisibility field to be set to LOCAL
-
visibility
Description copied from interface:ActiveDescriptorBuilder
This will set the descriptorVisibility field of the returned descriptor- Specified by:
visibility
in interfaceActiveDescriptorBuilder
- Parameters:
visibility
- The non-null visibility that this descriptor should take- Returns:
- A DescriptorBuilder with the descriptorVisibility field set to the input value
-
asType
Description copied from interface:ActiveDescriptorBuilder
Call this if the parameterized type of the implementation class is known. This may be called with any Type, but only a ParameterizedType based on the implementationClass will work- Specified by:
asType
in interfaceActiveDescriptorBuilder
- Parameters:
t
- The non-null ParameterizedType describing the implementation- Returns:
- A DescriptorBuilder with the given implementationType
-
build
Description copied from interface:ActiveDescriptorBuilder
Generates a descriptor that can be used in binding operations- Specified by:
build
in interfaceActiveDescriptorBuilder
- Returns:
- The descriptor that has been built up
- Throws:
IllegalArgumentException
- if the built descriptor is invalid
-
buildFactory
Deprecated.Description copied from interface:ActiveDescriptorBuilder
Generates a descriptor that can be used in binding operations that describes a factorys provide method- Specified by:
buildFactory
in interfaceActiveDescriptorBuilder
- Returns:
- The descriptor that has been built up, of type PROVIDE_METHOD
- Throws:
IllegalArgumentException
- if the built descriptor is invalid
-
buildProvideMethod
Description copied from interface:ActiveDescriptorBuilder
Generates a descriptor that can be used in binding operations that describes a factorys provide method- Specified by:
buildProvideMethod
in interfaceActiveDescriptorBuilder
- Returns:
- The descriptor that has been built up, of type PROVIDE_METHOD
- Throws:
IllegalArgumentException
- if the built descriptor is invalid
-