public class DelegatingNamedActiveDescriptor extends java.lang.Object implements ActiveDescriptor<java.lang.Object>
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
cache |
private boolean |
isSet |
private java.lang.Object |
lock |
private javax.inject.Named |
name |
private ActiveDescriptor<?> |
parent |
private java.util.HashSet<java.lang.String> |
qualifierNames |
private java.util.HashSet<java.lang.annotation.Annotation> |
qualifiers |
private int |
ranking |
Constructor and Description |
---|
DelegatingNamedActiveDescriptor(ActiveDescriptor<?> parent,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
create(ServiceHandle<?> root)
Creates an instance of the ActiveDescriptor.
|
void |
dispose(java.lang.Object instance)
Disposes this instance.
|
java.util.Set<java.lang.String> |
getAdvertisedContracts()
Returns the base class name of the contracts that
this service describes.
|
java.lang.Object |
getCache()
This can be used for scopes that will only every be created once.
|
java.lang.String |
getClassAnalysisName()
Returns the name of the
ClassAnalyzer service that
should be used to discover the constructors, initialization methods,
field and postConstruct and preDestory methods. |
java.util.Set<java.lang.reflect.Type> |
getContractTypes()
The set of types that this ActiveDescriptor must produce.
|
DescriptorType |
getDescriptorType()
Returns CLASS if this is a class descriptor
and FACTORY if this is a descriptor describing
a factory for a type, in which case the
implClass should point to the implementation
class of the factory
|
DescriptorVisibility |
getDescriptorVisibility()
Returns the visibility of this descriptor.
|
java.lang.Long |
getFactoryLocatorId()
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then
this field will return the ServiceId of its associated Factory
service.
|
java.lang.Long |
getFactoryServiceId()
If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then
this field will return the ServiceId of its associated Factory
service.
|
java.lang.String |
getImplementation()
Returns the fully qualified class
name of the implementation
class.
|
java.lang.Class<?> |
getImplementationClass()
The implementation class that should be used
to generate new instances of this descriptor.
|
java.lang.reflect.Type |
getImplementationType()
If known the Type of the implementation.
|
java.util.List<Injectee> |
getInjectees()
Returns the full list of Injectees this class has.
|
HK2Loader |
getLoader()
This returns the loader that should be used when
classloading this descriptor.
|
java.lang.Long |
getLocatorId()
This returns the id of the ServiceLocator which this descriptor
is registered with.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getMetadata()
Returns all of the metadata associated
that this object should be registered
with or looked up by
|
java.lang.String |
getName()
The name of this descriptor.
|
java.util.Set<java.lang.annotation.Annotation> |
getQualifierAnnotations()
The full set of qualifiers that this ActiveDescriptor
provides
|
java.util.Set<java.lang.String> |
getQualifiers()
Returns all of the annotation classes
that this object should be registered
with or looked up by
|
int |
getRanking()
Returns the ranking of this descriptor.
|
java.lang.String |
getScope()
Returns the fully qualified class name of
the scope annotation that should be
associated with this descriptor.
|
java.lang.Class<? extends java.lang.annotation.Annotation> |
getScopeAnnotation()
Returns the scope that this ActiveDescriptor belongs to
|
java.lang.annotation.Annotation |
getScopeAsAnnotation()
Returns the scope as an
Annotation
implementation that this ActiveDescriptor belongs to |
java.lang.Long |
getServiceId()
This returns the unique identifier for this descriptor.
|
boolean |
isCacheSet()
Returns true if this cache has been set
|
java.lang.Boolean |
isProxiable()
If this returns true then the system will create a proxy for
instances of this descriptor.
|
java.lang.Boolean |
isProxyForSameScope()
This value determines whether or not this service should be
proxied when being injected into other services of the same
scope.
|
boolean |
isReified()
This method returns true if this descriptor has been reified
(class loaded).
|
void |
releaseCache()
Removes the cached value and makes it such
that this cache has not been set
|
void |
setCache(java.lang.Object cacheMe)
Sets the value into the cache
|
int |
setRanking(int ranking)
Returns the ranking of this descriptor.
|
private final ActiveDescriptor<?> parent
private final javax.inject.Named name
private final java.util.HashSet<java.lang.String> qualifierNames
private final java.util.HashSet<java.lang.annotation.Annotation> qualifiers
private int ranking
private java.lang.Object lock
private java.lang.Object cache
private boolean isSet
DelegatingNamedActiveDescriptor(ActiveDescriptor<?> parent, java.lang.String name)
public java.lang.String getImplementation()
Descriptor
getImplementation
in interface Descriptor
public java.util.Set<java.lang.String> getAdvertisedContracts()
Descriptor
getAdvertisedContracts
in interface Descriptor
public java.lang.String getScope()
Descriptor
getScope
in interface Descriptor
public java.lang.String getName()
Descriptor
getName
in interface Descriptor
public java.util.Set<java.lang.String> getQualifiers()
Descriptor
getQualifiers
in interface Descriptor
public DescriptorType getDescriptorType()
Descriptor
getDescriptorType
in interface Descriptor
public DescriptorVisibility getDescriptorVisibility()
Descriptor
If the visibility is NORMAL then this descriptor may be seen by all children locators of the locator in which this descriptor is bound
If the visibility is LOCAL then this descriptor may only be seen by the servcie locator in which it is bound, and in none of the children of that locator
getDescriptorVisibility
in interface Descriptor
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getMetadata()
Descriptor
getMetadata
in interface Descriptor
public HK2Loader getLoader()
Descriptor
getLoader
in interface Descriptor
public int getRanking()
Descriptor
getRanking
in interface Descriptor
public int setRanking(int ranking)
Descriptor
The ranking of a service may change at any time during the life of the descriptor
setRanking
in interface Descriptor
ranking
- The new ranking this descriptor should havepublic java.lang.Boolean isProxiable()
Descriptor
ProxyCtl
interface
It is an error for this method to return true if the scope that
this descriptor is in is Unproxiable
(such as PerLookup).
isProxiable
in interface Descriptor
Proxiable
)public java.lang.Boolean isProxyForSameScope()
Descriptor
isProxyForSameScope
in interface Descriptor
public java.lang.String getClassAnalysisName()
Descriptor
ClassAnalyzer
service that
should be used to discover the constructors, initialization methods,
field and postConstruct and preDestory methods. If null the default
implementation will be used. Will be ignored for descriptors that
are not automatically analyzed by hk2getClassAnalysisName
in interface Descriptor
public java.lang.Long getServiceId()
Descriptor
getServiceId
in interface Descriptor
public java.lang.Long getLocatorId()
Descriptor
getLocatorId
in interface Descriptor
public java.lang.Object getCache()
SingleCache
getCache
in interface SingleCache<java.lang.Object>
public boolean isCacheSet()
SingleCache
isCacheSet
in interface SingleCache<java.lang.Object>
public void setCache(java.lang.Object cacheMe)
SingleCache
setCache
in interface SingleCache<java.lang.Object>
cacheMe
- A single value that can be cached in this
active descriptorpublic void releaseCache()
SingleCache
releaseCache
in interface SingleCache<java.lang.Object>
public boolean isReified()
ActiveDescriptor
isReified
in interface ActiveDescriptor<java.lang.Object>
public java.lang.Class<?> getImplementationClass()
ActiveDescriptor
If the class returned is a Factory, then the factory is used to create instances. In this case the system will get an instance of the factory and use it to create the instances
getImplementationClass
in interface ActiveDescriptor<java.lang.Object>
public java.lang.reflect.Type getImplementationType()
ActiveDescriptor
ActiveDescriptor.getImplementationClass()
getImplementationType
in interface ActiveDescriptor<java.lang.Object>
public java.util.Set<java.lang.reflect.Type> getContractTypes()
ActiveDescriptor
getContractTypes
in interface ActiveDescriptor<java.lang.Object>
public java.lang.annotation.Annotation getScopeAsAnnotation()
ActiveDescriptor
Annotation
implementation that this ActiveDescriptor belongs togetScopeAsAnnotation
in interface ActiveDescriptor<java.lang.Object>
Annotation
public java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()
ActiveDescriptor
getScopeAnnotation
in interface ActiveDescriptor<java.lang.Object>
public java.util.Set<java.lang.annotation.Annotation> getQualifierAnnotations()
ActiveDescriptor
getQualifierAnnotations
in interface ActiveDescriptor<java.lang.Object>
public java.util.List<Injectee> getInjectees()
ActiveDescriptor
If this descriptor is describing a factory created type then this list must have zero length
getInjectees
in interface ActiveDescriptor<java.lang.Object>
public java.lang.Long getFactoryServiceId()
ActiveDescriptor
getFactoryServiceId
in interface ActiveDescriptor<java.lang.Object>
public java.lang.Long getFactoryLocatorId()
ActiveDescriptor
getFactoryLocatorId
in interface ActiveDescriptor<java.lang.Object>
public java.lang.Object create(ServiceHandle<?> root)
ActiveDescriptor
create
in interface ActiveDescriptor<java.lang.Object>
root
- The root service handle, which can be used
to associated all the PerLookup objects with this creationpublic void dispose(java.lang.Object instance)
ActiveDescriptor
dispose
in interface ActiveDescriptor<java.lang.Object>
instance
- The instance to destroy