T
- The type returned from the cachepublic abstract class AbstractActiveDescriptor<T> extends DescriptorImpl implements ActiveDescriptor<T>
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.reflect.Type> |
advertisedContracts |
private T |
cachedValue |
private boolean |
cacheSet |
private static java.util.Set<java.lang.annotation.Annotation> |
EMPTY_QUALIFIER_SET |
private java.lang.Long |
factoryLocatorId |
private java.lang.Long |
factoryServiceId |
private boolean |
isReified |
private java.util.Set<java.lang.annotation.Annotation> |
qualifiers |
private java.util.concurrent.locks.Lock |
rLock |
private java.util.concurrent.locks.ReentrantReadWriteLock |
rwLock |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
scope |
private java.lang.annotation.Annotation |
scopeAnnotation |
private static long |
serialVersionUID
For serialization
|
private java.util.concurrent.locks.Lock |
wLock |
Modifier | Constructor and Description |
---|---|
|
AbstractActiveDescriptor()
For serialization
|
protected |
AbstractActiveDescriptor(Descriptor baseDescriptor)
Creates a NON reified ActiveDescriptor based on a copy of the given
baseDescriptor.
|
protected |
AbstractActiveDescriptor(java.util.Set<java.lang.reflect.Type> advertisedContracts,
java.lang.Class<? extends java.lang.annotation.Annotation> scope,
java.lang.String name,
java.util.Set<java.lang.annotation.Annotation> qualifiers,
DescriptorType descriptorType,
DescriptorVisibility descriptorVisibility,
int ranking,
java.lang.Boolean proxy,
java.lang.Boolean proxyForSameScope,
java.lang.String analyzerName,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
This constructor must be called with the information about
this descriptor
|
Modifier and Type | Method and Description |
---|---|
void |
addContractType(java.lang.reflect.Type addMe)
Adds an advertised contract to the set of contracts advertised by this descriptor
|
void |
addQualifierAnnotation(java.lang.annotation.Annotation addMe)
Adds the given string to the list of qualifiers
|
void |
dispose(T instance)
Disposes this instance.
|
boolean |
equals(java.lang.Object o)
This equals matches only if the following fields of the descriptor match:
implementation
contracts
name
scope
qualifiers
descriptorType
descriptorVisibility
metadata
proxiable
proxyForSameScope
analysisName
|
T |
getCache()
This can be used for scopes that will only every be created once.
|
java.util.Set<java.lang.reflect.Type> |
getContractTypes()
The set of types that this ActiveDescriptor must produce.
|
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.util.List<Injectee> |
getInjectees()
Returns the full list of Injectees this class has.
|
java.util.Set<java.lang.annotation.Annotation> |
getQualifierAnnotations()
The full set of qualifiers that this ActiveDescriptor
provides
|
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 |
int |
hashCode() |
boolean |
isCacheSet()
Returns true if this cache has been set
|
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
|
boolean |
removeContractType(java.lang.reflect.Type removeMe)
Removes an advertised contract from the set of contracts advertised by this descriptor
|
private void |
removeNamedQualifier() |
boolean |
removeQualifierAnnotation(java.lang.annotation.Annotation removeMe)
Removes the given qualifier from the list of qualifiers
|
void |
setCache(T cacheMe)
Sets the value into the cache
|
void |
setFactoryId(java.lang.Long locatorId,
java.lang.Long serviceId)
Sets the locator and serviceId for the factory.
|
void |
setName(java.lang.String name)
Sets the name of this descriptor.
|
void |
setReified(boolean reified)
This method is called to change the state of the
reification of this descriptor
|
void |
setScopeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation)
Sets the scope annotation for this descriptor
|
void |
setScopeAsAnnotation(java.lang.annotation.Annotation scopeAnnotation)
Sets the scope as an
Annotation implementation. |
addAdvertisedContract, addMetadata, addMetadata, addQualifier, clearMetadata, descriptorEquals, getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, pretty, readExternal, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setClassAnalysisName, setDescriptorType, setDescriptorVisibility, setImplementation, setLoader, setLocatorId, setMetadata, setProxiable, setProxyForSameScope, setRanking, setScope, setServiceId, toString, writeExternal, writeObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
create, getImplementationClass
getAdvertisedContracts, getClassAnalysisName, getDescriptorType, getDescriptorVisibility, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, isProxiable, isProxyForSameScope, setRanking
private static final long serialVersionUID
private static final java.util.Set<java.lang.annotation.Annotation> EMPTY_QUALIFIER_SET
private java.util.Set<java.lang.reflect.Type> advertisedContracts
private java.lang.annotation.Annotation scopeAnnotation
private java.lang.Class<? extends java.lang.annotation.Annotation> scope
private java.util.Set<java.lang.annotation.Annotation> qualifiers
private java.lang.Long factoryServiceId
private java.lang.Long factoryLocatorId
private boolean isReified
private transient boolean cacheSet
private transient T cachedValue
private final java.util.concurrent.locks.ReentrantReadWriteLock rwLock
private final java.util.concurrent.locks.Lock rLock
private final java.util.concurrent.locks.Lock wLock
public AbstractActiveDescriptor()
protected AbstractActiveDescriptor(Descriptor baseDescriptor)
baseDescriptor
- The non-null base descriptor to copy values fromprotected AbstractActiveDescriptor(java.util.Set<java.lang.reflect.Type> advertisedContracts, java.lang.Class<? extends java.lang.annotation.Annotation> scope, java.lang.String name, java.util.Set<java.lang.annotation.Annotation> qualifiers, DescriptorType descriptorType, DescriptorVisibility descriptorVisibility, int ranking, java.lang.Boolean proxy, java.lang.Boolean proxyForSameScope, java.lang.String analyzerName, java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
advertisedContracts
- The contracts that should be
advertised by this descriptor (may not be null, but may be
empty)scope
- The scope of this descriptor (may not be null)name
- The name of this descriptor (may be null)qualifiers
- The qualifiers of this descriptor (may not
be null, but may be empty)ranking
- The ranking for this descriptorlocatorId
- The id of the locator for this descriptormetadata
- Metadata to add to this descriptorprivate void removeNamedQualifier()
public void setName(java.lang.String name)
setName
in class DescriptorImpl
name
- The name for this descriptorpublic T getCache()
SingleCache
getCache
in interface SingleCache<T>
public boolean isCacheSet()
SingleCache
isCacheSet
in interface SingleCache<T>
public void setCache(T cacheMe)
SingleCache
setCache
in interface SingleCache<T>
cacheMe
- A single value that can be cached in this
active descriptorpublic void releaseCache()
SingleCache
releaseCache
in interface SingleCache<T>
public boolean isReified()
ActiveDescriptor
isReified
in interface ActiveDescriptor<T>
public void setReified(boolean reified)
reified
- true if this descriptor should appear reified,
false otherwisepublic java.util.Set<java.lang.reflect.Type> getContractTypes()
ActiveDescriptor
getContractTypes
in interface ActiveDescriptor<T>
public void addContractType(java.lang.reflect.Type addMe)
addMe
- The contract to add. May not be nullpublic boolean removeContractType(java.lang.reflect.Type removeMe)
removeMe
- The contract to remove. May not be nullpublic java.lang.annotation.Annotation getScopeAsAnnotation()
ActiveDescriptor
Annotation
implementation that this ActiveDescriptor belongs togetScopeAsAnnotation
in interface ActiveDescriptor<T>
Annotation
public void setScopeAsAnnotation(java.lang.annotation.Annotation scopeAnnotation)
Annotation
implementation.
This method will also modify the scope as a Class
and the underlying scope as a StringscopeAnnotation
- The scope as an Annotation
. May
not be nullpublic java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()
ActiveDescriptor
getScopeAnnotation
in interface ActiveDescriptor<T>
public void setScopeAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation)
scopeAnnotation
- The non-null scope annotation for this servicepublic java.util.Set<java.lang.annotation.Annotation> getQualifierAnnotations()
ActiveDescriptor
getQualifierAnnotations
in interface ActiveDescriptor<T>
public void addQualifierAnnotation(java.lang.annotation.Annotation addMe)
addMe
- The fully qualified class name of the qualifier to add. May not be nullpublic boolean removeQualifierAnnotation(java.lang.annotation.Annotation removeMe)
removeMe
- The fully qualifier class name of the qualifier to remove. May not be nullpublic java.lang.Long getFactoryServiceId()
ActiveDescriptor
getFactoryServiceId
in interface ActiveDescriptor<T>
public java.lang.Long getFactoryLocatorId()
ActiveDescriptor
getFactoryLocatorId
in interface ActiveDescriptor<T>
public void setFactoryId(java.lang.Long locatorId, java.lang.Long serviceId)
locatorId
- The locatorId of the factory associated with
this methodserviceId
- The serviceId of the factory associated with
this methodpublic 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<T>
public void dispose(T instance)
ActiveDescriptor
dispose
in interface ActiveDescriptor<T>
instance
- The instance to destroypublic int hashCode()
hashCode
in class DescriptorImpl
public boolean equals(java.lang.Object o)
DescriptorImpl
equals
in class DescriptorImpl
o
- The object to compare to this one. May be null (which will result in a false)