martinheidegger / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

MemberInitialization.factoryMethodName is not currently supported #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new PropertyBuilder
2. Set PropertyBuilder.memberInitialization to a new MemberIntialization
3. Set MemberInitialization.factoryMethodName = string representing a static 
function 

What is the expected output? What do you see instead?
Factory function is never called, class is instantiated normally via class 
constructor.

What version of the product are you using? On what operating system?
Trunk, OSX 10.7

Please provide any additional information below.
Searched project and there is no reference to factoryMethodName used anywhere. 
Expect it should be in PropertyBuilder.buildPropertyInitializers, but currently 
that method just always assumes its constructing the class manually. Need to 
use the factory method to pass complex objects to the constructor.

Original issue reported on code.google.com by jeff.ard...@gmail.com on 11 Aug 2011 at 12:53

GoogleCodeExporter commented 9 years ago
Hey there,

hehe, you got me there, that is indeed not implemented yet. Its been on my TODO 
list for a while, I had added the property already to the class a reminder, but 
no time to implement yet.
I'll see what I can do for you this evening, it shouldn't be that much work to 
implement. Bear with me :)

cheers,

Roland

Original comment by ihatelivelyids on 11 Aug 2011 at 2:58

GoogleCodeExporter commented 9 years ago
Cool, thanks. I'm cheating a bit for now to get it to work, since I'm only 
dealing with the same constructor args being pasted to each instance, I'm just 
using a static reference.

Original comment by jeff.ard...@gmail.com on 11 Aug 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Hey there,

I have this working again, I think. Changes are available in the trunk as usual.
There's two ways of using the factoryMethodName property. If you just give it a 
simple name:

factoryMethodName = "createPropertyValue";

It is assumed that this static method belongs to the same class as the property 
that its initializing.

But you can also enter a fully qualified method name:

factoryMethodName = "com.myclasses.MyPropertyInitClass.createPropertyValue";

That way you can define a static method that already exists as well. I.e. not a 
method that will be generated, but is normally compiled into your application.

Please confirm with me again if this works.

Thanks for the report again!

cheers,

Roland

Original comment by ihatelivelyids on 11 Aug 2011 at 4:28

GoogleCodeExporter commented 9 years ago
Works like a champ, thank you much!

Original comment by jeff.ard...@gmail.com on 11 Aug 2011 at 6:33

GoogleCodeExporter commented 9 years ago
great thanks for confirming!

Original comment by ihatelivelyids on 11 Aug 2011 at 7:14