Top Description Fields Constructors Methods
org.glassfish.hk2.utilities

public Class AliasDescriptor<T>

extends AbstractActiveDescriptor<T>
Class Inheritance
Type Parameters
<T>
The cache type
Imports
java.lang.annotation.Annotation, java.lang.reflect.Type, java.util.HashSet, .List, .Set, java.util.concurrent.locks.ReentrantLock, jakarta.inject.Named, org.glassfish.hk2.api.ActiveDescriptor, .HK2Loader, .Injectee, .ServiceHandle, .ServiceLocator, org.glassfish.hk2.utilities.general.GeneralUtilities

An active descriptor class that serves as an alias for another descriptor. This alias can have only one contract that may or may not also be advertised by the host descriptor. An AliasDescriptor can have a different name from the host descriptor as well
Author
tbeerbower

Field Summary

Modifier and TypeField and Description
public static final String
ALIAS_FREE_DESCRIPTOR

This is the value the metadata field ALIAS_METADATA_MARKER will take if the descriptor being aliased does not have a locator id or a service id

public static final String
ALIAS_METADATA_MARKER

This will be put in all Alias descriptors.

private String
contract

The contract type of this descriptor.

private ActiveDescriptor<T>
descriptor

The descriptor that this descriptor will alias.

private static final Set<Annotation>
EMPTY_ANNOTATION_SET

Empty set of annotations used to construct this descriptor.

private static final Set<Type>
EMPTY_CONTRACT_SET

Empty set of contracts used to construct this descriptor.

private boolean
initialized

Indicates whether or not this descriptor has been initialized.

private ServiceLocator
locator

The service locator.

private final ReentrantLock
private Set<String>
qualifierNames

The set of qualifier names for this descriptor.

private Set<Annotation>
qualifiers

Hides org.glassfish.hk2.utilities.AbstractActiveDescriptor.qualifiers.

The set of annotations for this descriptor.
private static final long

Constructor Summary

AccessConstructor and Description
public
AliasDescriptor()

For serialization

public
AliasDescriptor(ServiceLocator
the service locator
locator
,
ActiveDescriptor<T>
the descriptor to be aliased
descriptor
,
String
the contact
contract
,
String
the name
name
)

Construct an AliasDescriptor.

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
private void
ensureInitialized()

Ensure that this descriptor has been initialized.

public boolean
equals(Object o)

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.equals.

This equals matches only if the following fields of the descriptor match:

  • implementation
  • contracts
  • name
  • scope
  • qualifiers
  • descriptorType
  • descriptorVisibility
  • metadata
  • proxiable
  • proxyForSameScope
  • analysisName
private static String
public Set<Type>
public ActiveDescriptor<T>

Returns:

the descriptor
getDescriptor
()

Get the descriptor being aliased.

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 List<Injectee>
public Set<Annotation>
public Set<String>
getQualifiers()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getQualifiers.

Implements org.glassfish.hk2.api.Descriptor.getQualifiers.

Returns all of the annotation classes that this object should be registered with or looked up by

public Class<? extends Annotation>
public int
hashCode()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.hashCode.

Returns a hash code value for this object.

public boolean
isReified()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.isReified.

Implements org.glassfish.hk2.api.ActiveDescriptor.isReified.

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

Inherited from org.glassfish.hk2.utilities.AbstractActiveDescriptor:
addContractTypeaddQualifierAnnotationgetCachegetFactoryLocatorIdgetFactoryServiceIdgetScopeAsAnnotationisCacheSetreleaseCacheremoveContractTyperemoveQualifierAnnotationsetCachesetFactoryIdsetImplementationTypesetNamesetReifiedsetScopeAnnotationsetScopeAsAnnotation

Field Detail

ALIAS_FREE_DESCRIPTORback to summary
public static final String ALIAS_FREE_DESCRIPTOR

This is the value the metadata field ALIAS_METADATA_MARKER will take if the descriptor being aliased does not have a locator id or a service id

ALIAS_METADATA_MARKERback to summary
public static final String ALIAS_METADATA_MARKER

This will be put in all Alias descriptors. The value will be ALIAS_FREE_DESCRIPTOR if the descritpor being aliased does not have a locator and service id. If the descriptor being aliased does have a locator and service id the value will be .

contractback to summary
private String contract

The contract type of this descriptor.

descriptorback to summary
private ActiveDescriptor<T> descriptor

The descriptor that this descriptor will alias.

EMPTY_ANNOTATION_SETback to summary
private static final Set<Annotation> EMPTY_ANNOTATION_SET

Empty set of annotations used to construct this descriptor.

EMPTY_CONTRACT_SETback to summary
private static final Set<Type> EMPTY_CONTRACT_SET

Empty set of contracts used to construct this descriptor.

initializedback to summary
private boolean initialized

Indicates whether or not this descriptor has been initialized.

locatorback to summary
private ServiceLocator locator

The service locator.

lockback to summary
private final ReentrantLock lock

Hides org.glassfish.hk2.utilities.DescriptorImpl.lock.

qualifierNamesback to summary
private Set<String> qualifierNames

The set of qualifier names for this descriptor.

qualifiersback to summary
private Set<Annotation> qualifiers

Hides org.glassfish.hk2.utilities.AbstractActiveDescriptor.qualifiers.

The set of annotations for this descriptor.

serialVersionUIDback to summary
private static final long serialVersionUID

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

For serialization

Constructor Detail

AliasDescriptorback to summary
public AliasDescriptor()

For serialization

AliasDescriptorback to summary
public AliasDescriptor(ServiceLocator locator, ActiveDescriptor<T> descriptor, String contract, String name)

Construct an AliasDescriptor.

Parameters
locator:ServiceLocator

the service locator

descriptor:ActiveDescriptor<T>

the descriptor to be aliased

contract:String

the contact

name:String

the name

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
ensureInitializedback to summary
private void ensureInitialized()

Ensure that this descriptor has been initialized.

Annotations
@SuppressWarnings:unchecked
equalsback to summary
public boolean equals(Object o)

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.equals.

Doc from org.glassfish.hk2.utilities.DescriptorImpl.equals.

This equals matches only if the following fields of the descriptor match:

  • implementation
  • contracts
  • name
  • scope
  • qualifiers
  • descriptorType
  • descriptorVisibility
  • metadata
  • proxiable
  • proxyForSameScope
  • analysisName
Annotations
@Override
getAliasMetadataValueback to summary
private static String getAliasMetadataValue(ActiveDescriptor<?> descriptor)
getContractTypesback to summary
public Set<Type> getContractTypes()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getContractTypes.

Implements org.glassfish.hk2.api.ActiveDescriptor.getContractTypes.

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

Annotations
@Override
getDescriptorback to summary
public ActiveDescriptor<T> getDescriptor()

Get the descriptor being aliased.

Returns:ActiveDescriptor<T>

the descriptor

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
getInjecteesback to summary
public List<Injectee> getInjectees()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getInjectees.

Implements org.glassfish.hk2.api.ActiveDescriptor.getInjectees.

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

Annotations
@Override
getQualifierAnnotationsback to summary
public Set<Annotation> getQualifierAnnotations()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getQualifierAnnotations.

Implements org.glassfish.hk2.api.ActiveDescriptor.getQualifierAnnotations.

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

The full set of qualifiers that this ActiveDescriptor provides

Annotations
@Override
getQualifiersback to summary
public Set<String> getQualifiers()

Overrides org.glassfish.hk2.utilities.DescriptorImpl.getQualifiers.

Implements org.glassfish.hk2.api.Descriptor.getQualifiers.

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

Returns all of the annotation classes that this object should be registered with or looked up by

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

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.getScopeAnnotation.

Implements org.glassfish.hk2.api.ActiveDescriptor.getScopeAnnotation.

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

Returns the scope that this ActiveDescriptor belongs to

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
isReifiedback to summary
public boolean isReified()

Overrides org.glassfish.hk2.utilities.AbstractActiveDescriptor.isReified.

Implements org.glassfish.hk2.api.ActiveDescriptor.isReified.

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

Annotations
@Override