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.lifecycleManager, logger, muleContext| 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. |
void |
applyLifecycle(Object object,
String startPhase,
String toPhase)
Applies lifecycle phase to an object independent of the current lifecycle phase.
|
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, unregisterObjectpublic SimpleRegistry(MuleContext muleContext)
protected void doInitialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
doInitialise in class TransientRegistryorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic <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 org.mule.runtime.api.exception.MuleException
applyLifecycle in interface LifecycleRegistryobject - the object to processorg.mule.runtime.api.exception.MuleException - if the registry fails to perform the lifecycle change for the object.public Object applyLifecycle(Object object, String phase) throws org.mule.runtime.api.exception.MuleException
phase 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 fireorg.mule.runtime.api.exception.MuleException - if the registry fails to perform the lifecycle change for the object.public void applyLifecycle(Object object, String startPhase, String toPhase) throws org.mule.runtime.api.exception.MuleException
startPhase
and the endPhase will be executed.applyLifecycle in interface LifecycleRegistryobject - the object to apply lifecycle tostartPhase - the lifecycle phase the object is currently in. Must not be null.toPhase - the lifecycle phase to transition the object to. Must not be null.org.mule.runtime.api.exception.MuleException - if there is an exception while invoking lifecycle on the objectpublic <T> T inject(T object)
protected Object applyProcessors(Object object, Object metadata)
applyProcessors in class TransientRegistryCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.