|
||||||||||
| 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 |
| Fields inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
|---|
descriptor, logger |
| Constructor Summary | |
|---|---|
LazyInhabitant(Habitat habitat,
Holder<ClassLoader> cl,
String typeName,
MultiMap<String,String> metadata)
|
|
LazyInhabitant(Habitat habitat,
Holder<ClassLoader> cl,
String typeName,
MultiMap<String,String> metadata,
Inhabitant<?> lead)
|
|
| Method Summary | |
|---|---|
protected Creator<T> |
createCreator(Class<T> c)
Creates Creator for instantiating objects. |
protected void |
fetch()
|
ClassLoader |
getClassLoader()
|
Inhabitant<?> |
lead()
If this inhabitant is a companion to another inhabitant (called "lead"), This method returns that inhabitant. |
protected Class<T> |
loadClass()
|
MultiMap<String,String> |
metadata()
Gets the metadata associated with this inhabitant. |
void |
release()
Called to orderly shutdown Habitat. |
Class<? extends T> |
type()
Type of the inhabitant. |
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, isActive, notify, removeInhabitantListener, toString |
| Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
|---|
companions, dispose, get, getAnnotation, getAnnotation, getAnnotations, getDescriptor, getDescriptorFor, getProvider, getProvider, getSerializedMetadata, getSerializedMetadata, matches, 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<ClassLoader> cl,
String typeName,
MultiMap<String,String> metadata)
public LazyInhabitant(Habitat habitat,
Holder<ClassLoader> cl,
String typeName,
MultiMap<String,String> metadata,
Inhabitant<?> lead)
| Method Detail |
|---|
public Inhabitant<?> lead()
Inhabitant
lead in interface Inhabitant<T>lead in class AbstractInhabitantImpl<T>public String typeName()
Inhabitanttype().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 MultiMap<String,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 ClassLoader getClassLoader()
getClassLoader in interface ClassLoaderHolderprotected Class<T> loadClass()
public void release()
InhabitantHabitat.
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 ManagedComponentProvider<T>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 | |||||||||