com.sun.hk2.component
Class AbstractCreatorInhabitantImpl<T>
java.lang.Object
org.glassfish.hk2.utilities.DescriptorImpl
com.sun.hk2.component.AbstractInhabitantImpl<T>
com.sun.hk2.component.AbstractCreatorInhabitantImpl<T>
- All Implemented Interfaces:
- Holder<T>, Serializable, Descriptor, Binding<T>, Factory<T>, ManagedComponentProvider<T>, Provider<T>, Releasable, Inhabitant<T>
- Direct Known Subclasses:
- ScopedInhabitant
Deprecated.
@Deprecated
public abstract class AbstractCreatorInhabitantImpl<T>
- extends AbstractInhabitantImpl<T>
Partial implementation of Inhabitant
that delegates to Creator
for object creation.
Derived types are expected to implement the AbstractInhabitantImpl.get()
method and
choose when to create an object.
- Author:
- Kohsuke Kawaguchi
- See Also:
- Serialized Form
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder |
Holder.Impl<T> |
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
companions, dispose, get, getAnnotation, getAnnotation, getAnnotations, getByType, getDescriptor, getDescriptorFor, getProvider, getProvider, getSerializedMetadata, getSerializedMetadata, lead, matches, setCompanions, toString |
Methods inherited from class org.glassfish.hk2.utilities.DescriptorImpl |
addAdvertisedContract, addMetadata, addQualifier, equals, getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, hashCode, pretty, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setBaseDescriptor, setDescriptorType, setImplementation, setLoader, setLocatorId, setName, setRanking, setScope, setServiceId, writeObject |
Methods inherited from interface org.glassfish.hk2.api.Descriptor |
getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, setRanking |
creator
protected final Creator<T> creator
- Deprecated.
AbstractCreatorInhabitantImpl
protected AbstractCreatorInhabitantImpl(Creator<T> creator)
- Deprecated.
AbstractCreatorInhabitantImpl
public AbstractCreatorInhabitantImpl(Descriptor descriptor,
Creator<T> creator)
- Deprecated.
typeName
public final String typeName()
- Deprecated.
- Description copied from interface:
Inhabitant
- The short-cut for
type().getName()
but this allows us to defer loading the actual types.
type
public final Class<? extends T> type()
- Deprecated.
- Description copied from interface:
Inhabitant
- Type of the inhabitant.
The only binding contract that needs to be honored is that the Inhabitant.get()
method returns an instance assignable to this type. That is,
get().getClass()==type()
doesn't necessarily have to hold,
but type().isInstance(get())
must.
This is particularly true when Factory
is involved, as in such
case HK2 has no way of knowing the actual type.
That said, this method is not designed for the semantics of
contract/implementation split --- implementations of a contract
should return the concrete type from this method, and use
habitat index
to support look-up by contract.
- Returns:
- Always non-null, same value.
metadata
public Map<String,List<String>> metadata()
- Deprecated.
- Description copied from interface:
Inhabitant
- Gets the metadata associated with this inhabitant.
This data is usually used by a sub-system of HK2, and not really meant to
be used by applications. (At least for now.)
The main benefit of metadata is that it's available right away
as soon as the ServiceLocator
is properly initialized, even before
component classes are loaded. In contrast, accessing annotations would require
classes to be loaded and resolved.
- Returns:
- can be empty but never null. The values are read-only.
- See Also:
Service.metadata()
getCreator
public Creator<T> getCreator()
- Deprecated.
Copyright © 2013 Oracle Corporation. All Rights Reserved.