Hi Robert,

thanks for your reply. My problem is that the BeanWriter has to decide at runtime if it should descend into the return value of getStandardProperty() or getOtherProperty(). It's needed for some kind of 'preview' functionality where non-standard data needs to be written. I can't implement this in the data model because it would create dependencies between the data model and the runtime behaviour.

I'd like to have that "option" approach working because this way I could define in the .betwixt file what property needs to be changed to another method in the case of a preview. Obviously putting this knowledge in the BeanWriter wouldn't be too smart either, hard-coding class and method names from the data model which need to be changed.

Changing the property value is perfect, but change it to what value? That's where the option should come in. Unfortunately, the BeanWriter doesn't introspect bean metadata until a bean class is written for the first time, so I figured that some strategy would help that allows the introspector to access options from the .betwixt file. I didn't find anything now where this could fit in so I'm a bit lost...

-  Christian

Am 25.05.2005 um 22:36 schrieb robert burrell donkin:

hi christian

i'm not sure that this is possible right now. i'm also not too sure
whether it'd be possible to add an easy implementation to betwixt.

one thing i'm a little unclear about is why using an option in the
betwixt file is preferable to just changing the property attribute
value. will you explain?

- robert

On Tue, 2005-05-24 at 13:30 +0200, Christian Aust wrote:
Hi,

I'd like to customize the way betwixt maps Java types at runtime. See this:

Class file (shortened for readability):
==============================================================
class MyBean {
public Object getStandardProperty() {}
public Object getOtherProperty() {}
}
==============================================================

.betwixt file:
==============================================================
<?xml version="1.0" encoding="UTF-8" ?>
<info>
<element name="mybean">
        <element name="attachedObject" property="standardProperty">
                <option>
                        <name>ifPreview</name>
                        <value>otherProperty</value>
                </option>
        </element>
        <addDefaults/>
</element>
</info>
==============================================================

I'd like to implement some (pluggable?) strategy that checks if that option "ifPreview" is set and in that case returns the value of getOtherProperty() instead of
getStandardProperty() as the element named "mybean.attachedObject".

I've tried a number of strategies, but couldn't find the right one. Could somebody
please assist me in the right direction? Regards,

-  Christian



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--

Christian Aust
mailto:[EMAIL PROTECTED]
icq: 84500990 - Yahoo!: datenimperator - MSN: datenimperator
PGP: A94E 0181 664D 27E3 F05A  A751 6A7E 90D1 A0A3 DEC7


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to