Not quite sure of the “right” way to handle this one.
I have a bean, a transient, that there will be several of. It has several setters on it, but the first setter returns a “key”. For example:
local.oX = createObject(‘component’, ‘x’)
local.sKey = local.oX.addFeature(args…);
The next calls required the “key”.
local.oX.setSomething(local.sKey, ‘a’);
local.oX.setSomethingElse(local.sKey, ‘b’);
For a given object, I could have n… calls to these types of functions, one “addFeature” per feature. Now, in my Wirebox file, I’m doing this all in straight code. Honestly, I’m not even sure how to “name” the objects (Wirebox alias) doing this style.
But short of creating a massive inline struct (which is horribly impossible in CF9, unlike Railo), and passing said struct as an initArg() to each bean to handle the n… calls I might have to set it up, I don’t know a better way to do it. I’m concerned that I’m a) creating a bunch of bean configs when the bean might not get called and b) that when I do call it, the binder doesn’t actually execute at runtime, as wirebox.getInstance() won’t know how to run a function to create them. Can anyone offer some insight as to the right way to do this with my poblem at hand?
I’m sure some factory method would be the right way to go, but just haven’t had to do this before. Again, I’m trying to avoid passing a large init struct of arrays of structs, etc.