|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.hk2.component.AbstractInhabitantImpl<T>
com.sun.hk2.component.EventPublishingInhabitant<T>
com.sun.hk2.component.LazyInhabitant<T>
public class LazyInhabitant<T>
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.sun.hk2.component.Holder |
---|
Holder.Impl<T> |
Field Summary | |
---|---|
protected Habitat |
habitat
|
Fields inherited from class com.sun.hk2.component.EventPublishingInhabitant |
---|
real |
Constructor Summary | |
---|---|
LazyInhabitant(Habitat habitat,
Holder<java.lang.ClassLoader> cl,
java.lang.String typeName,
MultiMap<java.lang.String,java.lang.String> metadata)
|
|
LazyInhabitant(Habitat habitat,
Holder<java.lang.ClassLoader> cl,
java.lang.String typeName,
MultiMap<java.lang.String,java.lang.String> metadata,
Inhabitant<?> lead)
|
Method Summary | |
---|---|
protected Creator<T> |
createCreator(java.lang.Class<T> c)
Creates Creator for instantiating objects. |
protected void |
fetch()
|
java.lang.ClassLoader |
getClassLoader()
|
Inhabitant<?> |
lead()
If this inhabitant is a companion to another inhabitant (called "lead"), This method returns that inhabitant. |
protected java.lang.Class<T> |
loadClass()
|
MultiMap<java.lang.String,java.lang.String> |
metadata()
Gets the metadata associated with this inhabitant. |
void |
release()
Called to orderly shutdown Habitat . |
java.lang.Class<T> |
type()
Type of the inhabitant. |
java.lang.String |
typeName()
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, get, isInstantiated, notify, removeInhabitantListener, toString |
Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
---|
companions, get, getAnnotation, getAnnotation, getSerializedMetadata, getSerializedMetadata, setCompanions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Habitat habitat
Constructor Detail |
---|
public LazyInhabitant(Habitat habitat, Holder<java.lang.ClassLoader> cl, java.lang.String typeName, MultiMap<java.lang.String,java.lang.String> metadata)
public LazyInhabitant(Habitat habitat, Holder<java.lang.ClassLoader> cl, java.lang.String typeName, MultiMap<java.lang.String,java.lang.String> metadata, Inhabitant<?> lead)
Method Detail |
---|
public Inhabitant<?> lead()
Inhabitant
lead
in interface Inhabitant<T>
lead
in class AbstractInhabitantImpl<T>
public java.lang.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 java.lang.Class<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 Inhabitant<T>
type
in class EventPublishingInhabitant<T>
public MultiMap<java.lang.String,java.lang.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 Habitat
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 java.lang.ClassLoader getClassLoader()
getClassLoader
in interface ClassLoaderHolder
protected java.lang.Class<T> loadClass()
public void release()
Inhabitant
Habitat
.
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 Inhabitant<T>
release
in class EventPublishingInhabitant<T>
protected Creator<T> createCreator(java.lang.Class<T> c)
Creator
for instantiating objects.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |