Top Description Fields Constructors Methods
org.jvnet.hk2.internal

public Class OptionalActiveDescriptor<T>

extends AbstractActiveDescriptor<Optional<T>>
Class Inheritance
Imports
java.lang.reflect.Type, java.util.HashSet, .Optional, org.glassfish.hk2.api.DescriptorType, .DescriptorVisibility, .Injectee, .PerLookup, .ServiceHandle, org.glassfish.hk2.utilities.AbstractActiveDescriptor, org.glassfish.hk2.utilities.reflection.ReflectionHelper

Descriptor for Optional to allow for injection of a service if it exists or else Optional#EMPTY. It will also allow for injection of an Optional directly as well.
Author
jonathan coustick

Field Summary

Modifier and TypeField and Description
private Injectee
private ServiceLocatorImpl

Constructor Summary

AccessConstructor and Description
public
OptionalActiveDescriptor()

For serialization

pack-priv

Method Summary

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

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

Creates an instance of the ActiveDescriptor.

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.

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

Field Detail

injecteeback to summary
private Injectee injectee
locatorback to summary
private ServiceLocatorImpl locator

Constructor Detail

OptionalActiveDescriptorback to summary
public OptionalActiveDescriptor()

For serialization

OptionalActiveDescriptorback to summary
pack-priv OptionalActiveDescriptor(Injectee injectee, ServiceLocatorImpl locator)

Method Detail

createback to summary
public Optional<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
@SuppressWarnings:unchecked
@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