Project: mule
Issue MULE-8609: Should be able to fetch prototype by name without lifecycle applied
In most scenarios, when a prototype is lookup up by name, lifecycle should be applied to it before returning. There're some scenarios (e.g.: fetching a MessageProcessor that will go into a DynamicPipeline) which are not so and we need a way to specify that this case is different. The following method was applied to the LifecycleRegistry to support such case: {code:java} /** * Look up a single object by name. *

* Because {@link #lookupObject(String)} will * return objects which had lifecycle phases * applied,this method exists for cases in which * you want to specify that lifecycle is not to be * applied. The actual semantics of that actually depends * on the implementation, since invoking this method * might return a new instance or an already existing one. * If an existing one is returned, then the lifecycle might * have been previously applied regardless. * * @param key the key of the object you're looking for * @param applyLifecycle if lifecycle should be applied to the returned object. * Passing {@code true} doesn't guarantee that the lifecycle is applied * @return object or {@code null} if not found */ T lookupObject(String key, boolean applyLifecycle); {code}
Story points: 1