public class SimpleRegistry extends TransientRegistry implements LifecycleRegistry, Injector
LifecycleRegistry. Useful for starting really lightweight
contexts which don't depend on heavier object containers such as Spring or Guice (testing being
the best example).
The inject(Object) operation will only consider fields annotated with Inject and will perform
the injection using simple, not-cached reflection. Also, initialisation lifecycle will be performed
in pseudo-random order, no analysis will be done to ensure that dependencies of a given object
get their lifecycle before it.TransientRegistry.RegistryMaplifecycleManager, logger, muleContextPHASE_NAMEPHASE_NAME| Constructor and Description |
|---|
SimpleRegistry(MuleContext muleContext) |
| Modifier and Type | Method and Description |
|---|---|
Object |
applyLifecycle(Object object)
Will fire any lifecycle methods according to the current lifecycle without actually
registering the object in the registry.
|
Object |
applyLifecycle(Object object,
String phase)
Will fire the given lifecycle
phase without actually
registering the object in the registry. |
protected Object |
applyProcessors(Object object,
Object metadata) |
protected void |
doInitialise() |
protected void |
doRegisterObject(String key,
Object object,
Object metadata) |
<T> T |
inject(T object)
Injects dependencies into the given object
|
<T> T |
lookupObject(String key,
boolean applyLifecycle)
This implementation doesn't support applying lifecycle upon lookup
and thus this method simply delegates into
TransientRegistry.lookupObject(String) |
applyProcessors, checkDisposed, doDispose, doGet, doPut, doUnregisterObject, hasFlag, isReadOnly, isRemote, lookupByType, lookupLocalObjects, lookupObject, lookupObject, lookupObjects, registerObject, registerObject, registerObjectscreateLifecycleManager, dispose, fireLifecycle, get, getLifecycleManager, getRegistryId, initialise, isInitialised, lookupObjectsForLifecycle, unregisterObject, unregisterObjectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfireLifecycle, get, getRegistryId, isReadOnly, isRemote, lookupByType, lookupLocalObjects, lookupObject, lookupObject, lookupObjects, lookupObjectsForLifecycle, registerObject, registerObject, registerObjects, unregisterObject, unregisterObjectinitialisedisposepublic SimpleRegistry(MuleContext muleContext)
protected void doInitialise()
throws InitialisationException
doInitialise in class TransientRegistryInitialisationExceptionpublic <T> T lookupObject(String key, boolean applyLifecycle)
TransientRegistry.lookupObject(String)lookupObject in interface LifecycleRegistrykey - the key of the object you're looking forapplyLifecycle - if lifecycle should be applied to the returned object.
Passing true doesn't guarantee that the lifecycle is appliednull if not foundprotected void doRegisterObject(String key, Object object, Object metadata) throws RegistrationException
doRegisterObject in class TransientRegistryRegistrationExceptionpublic Object applyLifecycle(Object object) throws MuleException
TransientRegistryapplyLifecycle in interface LifecycleRegistryobject - the object to processMuleException - if the registry fails to perform the lifecycle change for the object.public Object applyLifecycle(Object object, String phase) throws MuleException
LifecycleRegistryphase without actually
registering the object in the registry. This is useful for prototype objects that are created per request and would
clutter the registry with single use objects.applyLifecycle in interface LifecycleRegistryobject - the object to processphase - the specific lifecycle phase you want to fireMuleException - if the registry fails to perform the lifecycle change for the object.public <T> T inject(T object)
Injectorprotected Object applyProcessors(Object object, Object metadata)
applyProcessors in class TransientRegistryCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.