Top Description Methods
org.glassfish.hk2.api

public Interface ActiveDescriptor<T>

extends Descriptor, SingleCache<T>
Known Direct Implementers
org.glassfish.hk2.utilities.AbstractActiveDescriptor
Type Parameters
<T>
This is the type produced by the cache and consumed by the cache
Imports
java.lang.annotation.Annotation, java.lang.reflect.Type, java.util.List, .Set

An ActiveDescriptor contains information about a Descriptor after it has been reified. Most of the methods in an ActiveDescriptor cannot be called until the isReified method return true. Prior to that the information is not yet known. ActiveDescriptors can be reified with the ServiceLocator.reifyDescriptor method.

ActiveDescriptors may also be provided to the system pre-reified, which is useful when the Service described may be produced by a third-party system. In this case the ActiveDescriptors create method must use the third-party system in order to create instances of the described service

Author
jwells

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

An instance of this ActiveDescriptor
create
(ServiceHandle<?>
The root service handle, which can be used to associated all the PerLookup objects with this creation
root
)

Creates an instance of the ActiveDescriptor.

public void
dispose(T
The instance to destroy
instance
)

Disposes this instance.

public Set<Type>

Returns:

the set of types this ActiveDescriptor must implement or extend
getContractTypes
()

The set of types that this ActiveDescriptor must produce.

public Long

Returns:

The locator ID of the associated factory service
getFactoryLocatorId
()

If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service.

public Long

Returns:

The service ID of the associated factory service
getFactoryServiceId
()

If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service.

public Class<?>

Returns:

The class that directly implements the contract types, or the class that is the factory for an object that implements the contract types
getImplementationClass
()

The implementation class that should be used to generate new instances of this descriptor.

public Type

Returns:

The type of the implementation or the implementation class
getImplementationType
()

If known the Type of the implementation.

public List<Injectee>

Returns:

Will not return null, but may return an empty list. The set of Injectees that must be resolved before this ActiveDescriptor can be constructed
getInjectees
()

Returns the full list of Injectees this class has.

public Set<Annotation>

Returns:

The set of annotations that this ActiveDescriptor provides
getQualifierAnnotations
()

The full set of qualifiers that this ActiveDescriptor provides

public Class<? extends Annotation>

Returns:

The scope of this ActiveDescriptor
getScopeAnnotation
()

Returns the scope that this ActiveDescriptor belongs to

public Annotation

Returns:

The scope of this ActiveDescriptor as an Annotation
getScopeAsAnnotation
()

Returns the scope as an Annotation implementation that this ActiveDescriptor belongs to

public boolean

Returns:

true if this descriptor has been reified, false otherwise
isReified
()

This method returns true if this descriptor has been reified (class loaded).

Inherited from org.glassfish.hk2.api.Descriptor:
getAdvertisedContractsgetClassAnalysisNamegetDescriptorTypegetDescriptorVisibilitygetImplementationgetLoadergetLocatorIdgetMetadatagetNamegetQualifiersgetRankinggetScopegetServiceIdisProxiableisProxyForSameScopesetRanking
Inherited from org.glassfish.hk2.api.SingleCache:
getCacheisCacheSetreleaseCachesetCache

Method Detail

createback to summary
public T create(ServiceHandle<?> root)

Creates an instance of the ActiveDescriptor. All of the Injectee's must be created prior to instantiation, and associated with the ExtendedProvider so that they can be destroyed properly

Parameters
root:ServiceHandle<?>

The root service handle, which can be used to associated all the PerLookup objects with this creation

Returns:T

An instance of this ActiveDescriptor

disposeback to summary
public void dispose(T instance)

Disposes this instance. All the PerLookup objects that were created for this instance will be destroyed after this object has been destroyed

Parameters
instance:T

The instance to destroy

getContractTypesback to summary
public Set<Type> getContractTypes()

The set of types that this ActiveDescriptor must produce. These types may be Classes or ParameterizedTypes, and may be no other subclass of Type

Returns:Set<Type>

the set of types this ActiveDescriptor must implement or extend

getFactoryLocatorIdback to summary
public Long getFactoryLocatorId()

If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service. Otherwise this method should return null

Returns:Long

The locator ID of the associated factory service

getFactoryServiceIdback to summary
public Long getFactoryServiceId()

If this ActiveDescriptor has DescriptorType of PROVIDE_METHOD then this field will return the ServiceId of its associated Factory service. Otherwise this method should return null

Returns:Long

The service ID of the associated factory service

getImplementationClassback to summary
public Class<?> getImplementationClass()

The implementation class that should be used to generate new instances of this descriptor.

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

Returns:Class<?>

The class that directly implements the contract types, or the class that is the factory for an object that implements the contract types

getImplementationTypeback to summary
public Type getImplementationType()

If known the Type of the implementation. If unknown will return the same as getImplementationClass()

Returns:Type

The type of the implementation or the implementation class

getInjecteesback to summary
public List<Injectee> getInjectees()

Returns the full list of Injectees this class has. These references will be resolved prior to the class being constructed, even if these injectees are field or method injectees.

If this descriptor is describing a factory created type then this list must have zero length

Returns:List<Injectee>

Will not return null, but may return an empty list. The set of Injectees that must be resolved before this ActiveDescriptor can be constructed

getQualifierAnnotationsback to summary
public Set<Annotation> getQualifierAnnotations()

The full set of qualifiers that this ActiveDescriptor provides

Returns:Set<Annotation>

The set of annotations that this ActiveDescriptor provides

getScopeAnnotationback to summary
public Class<? extends Annotation> getScopeAnnotation()

Returns the scope that this ActiveDescriptor belongs to

Returns:Class<? extends Annotation>

The scope of this ActiveDescriptor

getScopeAsAnnotationback to summary
public Annotation getScopeAsAnnotation()

Returns the scope as an Annotation implementation that this ActiveDescriptor belongs to

Returns:Annotation

The scope of this ActiveDescriptor as an Annotation

isReifiedback to summary
public boolean isReified()

This method returns true if this descriptor has been reified (class loaded). If this method returns false then the other methods in this interface will throw an IllegalStateException. Once this method returns true it may be

Returns:boolean

true if this descriptor has been reified, false otherwise