Influence instance build via closure in the binder

Description

This is similar to WIREBOX-46, but instead of overriding the ENTIRE creation process of the object like a provider does, the user might want to simply influence the creation of a "normal" mapping with some additional flair.

In this instance, the instance is already built and then passed into the closure for additional influence. Note, the object is returned from the closure. Make this optional, but if something IS returned, it will override the instance which will allow a developer to replace or decorate the instance as they see fit.

Activity

Show:
Brad Wood
October 5, 2015, 9:27 PM

Any feedback on this? Note, this is technically possible with a closure-based provider but I thought it might be nice instead of having to override the entire creation, to just be able to influence an existing mapping. If you liked this, I could do it along with the other 2 WireBox tickets I knocked out today.

Luis Majano
October 5, 2015, 9:58 PM

So this is similar to the influence closure in the mapDirectory methods. However, this is not for configuraiton but run-time usage. Meaning that we store the influence closure much like the AOP on creation listener. Is that accurate?

Brad Wood
October 5, 2015, 10:39 PM

I believe that's correct. I envisioned the closure being stored in the mapping object, and after the mapping instance was built, something like this would run:

Luis Majano
October 6, 2015, 2:30 PM
Edited

ok, sounds good, go for it, just make sure you add the appropriate tests for it.

Thanks

Brad Wood
October 6, 2015, 5:29 PM

https://github.com/ColdBox/coldbox-platform/pull/229

I also added in a test for being able to specify a provider as a closure since it was broken recently and fixed in another ticket.

Fixed

Assignee

Brad Wood

Reporter

Brad Wood

Labels

None

Time tracking

0m

Time remaining

1h

Fix versions

Priority

Major
Configure