(my apologies that took me a while to answer, i haven't been a bit ill.)
you're probably not going to like this but the bad news is that it's difficult to do what you want to do at the moment. the good news is have been looking at some stuff related to this recently and so there's a change that it might in sometime soonish.
as i see it, there are three basic strategies to accumplish this (but none of these currently work fully in betwixt).
use derived beans
-----------------
this means using an attribute of the xml to specify the class to be created. this need a little work (there is no setting to switch on writing these attributes, there is no beaninfo attribute to customize the attribute name and reading only sets the properties that the interface expresses). i might be persuaded to bring forward adding writing - or you could probably have a go at adding this functionality yourself (its pretty easy). if you do, then maybe you'd care to submit a patch :)
custom bean creator
-------------------
this is what i've been looking at today. betwixt's bean reading will be refactored to use a chain of bean creators rather than a monolithic method.
this will allow users to plug their own bean creators to create (say) implementations for their interfaces. i like this approach since it's powerful, elegant and flexible. if you like the sound of this then it'll probably be worth waiting around a few days until it's finished.
strategy interface for creating typed objects
---------------------------------------------
the ideas is that a hook would be provided to allow a creater to be registered for a particular type of object. unfortunately, i want to implement this as a bean creator so this is a way down the track.
please let me know how this sounds.
- robert
On Sunday, August 17, 2003, at 05:26 AM, Gary S. Cuozzo wrote:
I've been struggling with betwixt and trying to get it work with classes that make use of methods that accept/return interfaces. Is there any way to tell betwixt (or the underlying digester) when it sees an interface in the xml data that it should actually create an instance of some specific class that implements the interface? or, i suppose the alternative would be have the xml get generated with the class name as opposed to the interface name.
Any help is appreciated, gary. -- Gary S. Cuozzo <[EMAIL PROTECTED]> Innovation Software Group, LLC
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
