I guess another way to implement this would be to allow a developer at
runtime to set metadata on a the type railo.runtime.type.UDFImpl. At
least I would then be able to set metadata about the function to later
reference and act accordingly.
If this is possible now, please let me know. I am still digging
through the railo source...
Thanks,
James
On Jan 31, 2:55 pm, <
b...@bradwood.com> wrote:
> I can't speak for James, but WireBox (part of the ColdBox family) has been waiting on this functionality to have mixin support for ioc provider methods in Railo.
>
>
>
> For instance, let's say I am concerned about widening the scope of an injected dependency, so instead I create a provider method will retrieve the dependency from the ioc container when I need it at run time.
>
> Let's say the name of the provided object is UserService. WireBox lets you do that with the following code:
>
>
>
> component name="handler"singleton{
>
> functiongetUserService() provider="user"{}
>
> }
>
>
>
> The way WireBox achieves this is to replace the getUserService method with a generic provider mixin keeping the original name. That generic method then usesgetFunctionCalledName() when it is called to know what object it needs to retrieve when you call it. The only other way around that would be to write a temporary CFM file at run time with the object name baked-in and then cfinclude it at run-time.