|
||||||||||
| 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.RunLevelInhabitant<T,V>
public class RunLevelInhabitant<T,V>
An inhabitant that prevents activation unless the sufficient RunLevelState has been scheduled.
| 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 |
| Method Summary | |
|---|---|
static void |
enable(boolean enable)
FOR INTERNAL USE ONLY |
T |
get(Inhabitant onBehalfOf)
Returns the instance of this inhabitant. |
RunLevelState<?> |
getState()
|
Class<? extends T> |
type()
Type of the inhabitant. |
protected void |
verifyState()
Verifies that the state of the RunLevelService is appropriate for this instance activation. |
| Methods inherited from class com.sun.hk2.component.EventPublishingInhabitant |
|---|
addInhabitantListener, fetch, isActive, metadata, notify, release, removeInhabitantListener, toString, typeName |
| Methods inherited from class com.sun.hk2.component.AbstractInhabitantImpl |
|---|
companions, dispose, get, getAnnotation, getAnnotation, getAnnotations, getDescriptor, getDescriptorFor, getProvider, getProvider, getSerializedMetadata, getSerializedMetadata, lead, matches, setCompanions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static void enable(boolean enable)
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 T get(Inhabitant onBehalfOf)
InhabitantTHIS METHOD SHOULD BE ONLY USED BY HK2 IMPLEMENTATION.
Inhabitants are often used with the decorator pattern
(see AbstractCreatorInhabitantImpl for example), yet during
the object initializtion inside the Inhabitant.get() method, we often
need the reference to the outer-most Inhabitant registered to
the Habitat (for example so that we can request the injection
of {link Inhabita} that represents itself, or to inject companions.)
So this overloaded version of the get method takes the outer-most
Inhabitant. This method is only invoked from within HK2
where the decorator pattern is used.
get in interface Inhabitant<T>get in class EventPublishingInhabitant<T>
protected void verifyState()
throws ComponentException
ComponentException - if not in an appropriate statepublic RunLevelState<?> getState()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||