Top Fields Constructors Methods
org.jvnet.hk2.internal

public Class ConstantActiveDescriptor<T>

extends AbstractActiveDescriptor<T>
Class Inheritance
Type Parameters
<T>
The type of the constant
Imports
java.lang.annotation.Annotation, java.lang.reflect.Type, java.util.HashSet, .List, .Map, .Set, org.glassfish.hk2.api.DescriptorType, .DescriptorVisibility, .PerLookup, .ServiceHandle, org.glassfish.hk2.utilities.AbstractActiveDescriptor

Author
jwells

Field Summary

Modifier and TypeField and Description
private Long
private static final long
private T

Constructor Summary

AccessConstructor and Description
public
ConstantActiveDescriptor()

For serialization

public
ConstantActiveDescriptor(T
the object to create it from
theOne
,
ServiceLocatorImpl
the locator this is being created for
locator
)

Creates a constant active descriptor with the given locator

public
ConstantActiveDescriptor(T
The non-null constant
theOne
,
Set<Type>
its advertised contracts
advertisedContracts
,
Class<? extends Annotation>
its scope
scope
,
String
its possibly null name
name
,
Set<Annotation>
its set of qualifiers
qualifiers
,
DescriptorVisibility
its visibility
visibility
,
int
its starting rank
ranking
,
Boolean
can it be proxied (null for default)
proxy
,
Boolean
will it be proxied for the same scope (null for default)
proxyForSameScope
,
String
The name of the analyzer (null for default)
analyzerName
,
long
its locator parent
locatorId
,
Map<String, List<String>>
The metadata associated with it
metadata
)

Constructor with more control over the fields of the descriptor

Method Summary

Modifier and TypeMethod and Description
public T
create(ServiceHandle<?> root)

Implements org.glassfish.hk2.api.ActiveDescriptor.create.

Creates an instance of the ActiveDescriptor.

public void
public T
getCache()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getCache.

Implements org.glassfish.hk2.api.SingleCache.getCache.

This can be used for scopes that will only every be created once.

public String
getImplementation()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getImplementation.

Implements org.glassfish.hk2.api.Descriptor.getImplementation.

Returns the fully qualified class name of the implementation class.

public Class<?>
getImplementationClass()

Implements org.glassfish.hk2.api.ActiveDescriptor.getImplementationClass.

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

public Type
getImplementationType()

Implements org.glassfish.hk2.api.ActiveDescriptor.getImplementationType.

If known the Type of the implementation.

public Long
getLocatorId()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getLocatorId.

Implements org.glassfish.hk2.api.Descriptor.getLocatorId.

This returns the id of the ServiceLocator which this descriptor is registered with.

public boolean
public void
Inherited from org.glassfish.hk2.utilities.AbstractActiveDescriptor:
addContractTypeaddQualifierAnnotationequalsgetContractTypesgetFactoryLocatorIdgetFactoryServiceIdgetInjecteesgetQualifierAnnotationsgetScopeAnnotationgetScopeAsAnnotationhashCodeisReifiedreleaseCacheremoveContractTyperemoveQualifierAnnotationsetCachesetFactoryIdsetNamesetReifiedsetScopeAnnotationsetScopeAsAnnotation

Field Detail

locatorIdback to summary
private Long locatorId

Hides org.glassfish.hk2.utilities.DescriptorImpl.locatorId.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.glassfish.hk2.utilities.AbstractActiveDescriptor.serialVersionUID.

For serialization

theOneback to summary
private T theOne

Constructor Detail

ConstantActiveDescriptorback to summary
public ConstantActiveDescriptor()

For serialization

ConstantActiveDescriptorback to summary
public ConstantActiveDescriptor(T theOne, ServiceLocatorImpl locator)

Creates a constant active descriptor with the given locator

Parameters
theOne:T

the object to create it from

locator:ServiceLocatorImpl

the locator this is being created for

ConstantActiveDescriptorback to summary
public ConstantActiveDescriptor(T theOne, Set<Type> advertisedContracts, Class<? extends Annotation> scope, String name, Set<Annotation> qualifiers, DescriptorVisibility visibility, int ranking, Boolean proxy, Boolean proxyForSameScope, String analyzerName, long locatorId, Map<String, List<String>> metadata)

Constructor with more control over the fields of the descriptor

Parameters
theOne:T

The non-null constant

advertisedContracts:Set<Type>

its advertised contracts

scope:Class<? extends Annotation>

its scope

name:String

its possibly null name

qualifiers:Set<Annotation>

its set of qualifiers

visibility:DescriptorVisibility

its visibility

ranking:int

its starting rank

proxy:Boolean

can it be proxied (null for default)

proxyForSameScope:Boolean

will it be proxied for the same scope (null for default)

analyzerName:String

The name of the analyzer (null for default)

locatorId:long

its locator parent

metadata:Map<String, List<String>>

The metadata associated with it

Method Detail

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

Implements org.glassfish.hk2.api.ActiveDescriptor.create.

Doc from org.glassfish.hk2.api.ActiveDescriptor.create.

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

Annotations
@Override
disposeback to summary
public void dispose(T instance)

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.dispose.

Implements org.glassfish.hk2.api.ActiveDescriptor.dispose.

Doc from org.glassfish.hk2.api.ActiveDescriptor.dispose.

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

Annotations
@Override
getCacheback to summary
public T getCache()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getCache.

Implements org.glassfish.hk2.api.SingleCache.getCache.

Doc from org.glassfish.hk2.api.SingleCache.getCache.

This can be used for scopes that will only every be created once. The returned value must have been set previously with setCache. If this is called when isCacheSet is false will result in a RuntimeException

Annotations
@Override
getImplementationback to summary
public String getImplementation()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getImplementation.

Implements org.glassfish.hk2.api.Descriptor.getImplementation.

Doc from org.glassfish.hk2.api.Descriptor.getImplementation.

Returns the fully qualified class name of the implementation class. If this is a factory descriptor then this will return the fully qualified name of the class implementing the factory interface.

Annotations
@Override
getImplementationClassback to summary
public Class<?> getImplementationClass()

Implements org.glassfish.hk2.api.ActiveDescriptor.getImplementationClass.

Doc from org.glassfish.hk2.api.ActiveDescriptor.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

Annotations
@Override
getImplementationTypeback to summary
public Type getImplementationType()

Implements org.glassfish.hk2.api.ActiveDescriptor.getImplementationType.

Doc from org.glassfish.hk2.api.ActiveDescriptor.getImplementationType.

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

Annotations
@Override
getLocatorIdback to summary
public Long getLocatorId()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getLocatorId.

Implements org.glassfish.hk2.api.Descriptor.getLocatorId.

Doc from org.glassfish.hk2.api.Descriptor.getLocatorId.

This returns the id of the ServiceLocator which this descriptor is registered with. Returns null if this descriptor is not yet registered with a ServiceLocator

isCacheSetback to summary
public boolean isCacheSet()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.isCacheSet.

Implements org.glassfish.hk2.api.SingleCache.isCacheSet.

Doc from org.glassfish.hk2.api.SingleCache.isCacheSet.

Returns true if this cache has been set

Annotations
@Override
setImplementationTypeback to summary
public void setImplementationType(Type t)

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.setImplementationType.

Annotations
@Override