-
Inject static property
Hi, all.
I can't seem to find any documentation on how to inject the value of a static property of class A into a property of class B. Specifically, I want to inject the value of HTTPService.RESULT_FORMAT_E4X into an instance of another class using Spring AS. Any ideas?
I tried using factory-method already. That didn't work.
Here's what I tried -
Code:
<object id="b" class="B">
<constructor-arg>
<object class="mx.rpc.http.HTTPService" factory-method="RESULT_FORMAT_E4X" />
</constructor-arg>
</object>
Thanks much.
Jules
-
Hi there,
Take a look at the FieldRetrievingFactoryObject (http://www.springactionscript.org/do...ther_obj ects).
This should do the trick:
Code:
<object id="b" class="B">
<constructor-arg>
<object class="mx.rpc.http.HTTPService">
<property name="resultFormat">
<object class="org.springextensions.actionscript.ioc.factory.config.FieldRetrievingFactoryObject">
<property name="staticField" value="mx.rpc.http.HTTPService.RESULT_FORMAT_E4X"/>
</object>
</property>
</object>
</constructor-arg>
</object>
Cheers
herb
-
-
Hi,
you can also use the "util" namespace for this:
Code:
<util:constant static-field="mx.rpc.http.HTTPService.RESULT_FORMAT_E4X"/>
Be sure to add the UtilNamespaceHandler to the application context.
regards,
Christophe