|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glassfish.hk2.utilities.DescriptorImpl
com.sun.hk2.component.AbstractInhabitantImpl<T>
com.sun.hk2.component.EventPublishingInhabitant<T>
com.sun.hk2.component.LazyInhabitant<T>
@Deprecated public class LazyInhabitant<T>
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder |
---|
Holder.Impl<T> |
Field Summary |
---|
Fields inherited from class com.sun.hk2.component.EventPublishingInhabitant |
---|
real |
Fields inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
---|
descriptor, logger |
Constructor Summary | |
---|---|
LazyInhabitant(ServiceLocator serviceLocator,
HK2Loader hk2CL,
String typeName,
Map<String,List<String>> metadata)
Deprecated. |
|
LazyInhabitant(ServiceLocator serviceLocator,
HK2Loader cl,
String typeName,
Map<String,List<String>> metadata,
Inhabitant<?> lead)
Deprecated. |
Method Summary | |
---|---|
protected Creator<T> |
createCreator(Class<T> c)
Deprecated. Creates Creator for instantiating objects. |
protected void |
fetch()
Deprecated. |
ClassLoader |
getClassLoader()
Deprecated. |
Inhabitant<?> |
lead()
Deprecated. If this inhabitant is a companion to another inhabitant (called "lead"), This method returns that inhabitant. |
protected Class<T> |
loadClass()
Deprecated. |
Map<String,List<String>> |
metadata()
Deprecated. Gets the metadata associated with this inhabitant. |
void |
release()
Deprecated. Called to orderly shutdown ServiceLocator . |
Class<? extends T> |
type()
Deprecated. Type of the inhabitant. |
Class<? extends T> |
type(HK2Loader loader)
Deprecated. |
String |
typeName()
Deprecated. The short-cut for type().getName()
but this allows us to defer loading the actual types. |
Methods inherited from class com.sun.hk2.component.EventPublishingInhabitant |
---|
addInhabitantListener, equals, get, getServiceLocator, hashCode, isActive, notify, removeInhabitantListener, toString |
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
---|
companions, dispose, get, getAnnotation, getAnnotation, getAnnotations, getByType, getDescriptor, getDescriptorFor, getProvider, getProvider, getSerializedMetadata, getSerializedMetadata, matches, setCompanions |
Methods inherited from class org.glassfish.hk2.utilities.DescriptorImpl |
---|
addAdvertisedContract, addMetadata, addQualifier, getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, pretty, readObject, removeAdvertisedContract, removeAllMetadata, removeMetadata, removeQualifier, setBaseDescriptor, setDescriptorType, setImplementation, setLoader, setLocatorId, setName, setRanking, setScope, setServiceId, writeObject |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.glassfish.hk2.api.Descriptor |
---|
getAdvertisedContracts, getBaseDescriptor, getDescriptorType, getImplementation, getLoader, getLocatorId, getMetadata, getName, getQualifiers, getRanking, getScope, getServiceId, setRanking |
Constructor Detail |
---|
public LazyInhabitant(ServiceLocator serviceLocator, HK2Loader hk2CL, String typeName, Map<String,List<String>> metadata)
public LazyInhabitant(ServiceLocator serviceLocator, HK2Loader cl, String typeName, Map<String,List<String>> metadata, Inhabitant<?> lead)
Method Detail |
---|
public Inhabitant<?> lead()
Inhabitant
lead
in interface Inhabitant<T>
lead
in class AbstractInhabitantImpl<T>
public String typeName()
Inhabitant
type().getName()
but this allows us to defer loading the actual types.
typeName
in interface Inhabitant<T>
typeName
in class EventPublishingInhabitant<T>
public Class<? extends T> type()
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.
type
in interface Provider<T>
type
in interface Inhabitant<T>
type
in class EventPublishingInhabitant<T>
public Class<? extends T> type(HK2Loader loader)
public Map<String,List<String>> metadata()
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.
metadata
in interface Inhabitant<T>
metadata
in class EventPublishingInhabitant<T>
Service.metadata()
protected void fetch()
fetch
in class EventPublishingInhabitant<T>
public final ClassLoader getClassLoader()
getClassLoader
in interface ClassLoaderHolder
protected Class<T> loadClass()
public void release()
Inhabitant
ServiceLocator
.
The expected behavior is for objects to get its PreDestroy
callback invoked, and its reference released. For singleton
objects, this method is expected to dispose that object.
For scoped objects, those are released when ScopeInstance.release()
is invoked.
release
in interface Releasable
release
in interface Inhabitant<T>
release
in class EventPublishingInhabitant<T>
protected Creator<T> createCreator(Class<T> c)
Creator
for instantiating objects.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |