Hi

JB_VXR wrote:
> Hi folks,
> 
> I'm new to Castor.  Everything works well, but something confuses me.  I
> have defined a Castor Map for use in Marshalling and Unmarshalling.  I have
> a class like...
> 
> MyClass
> {
>    private String myString;
>    private Object myObject;
> 
>    public void setMyString(String str) {...}
>    public void setMyObject(Object obj) {...}
> }
> 
> I set a breakpoint in both setters (using Eclipse).
> 
> The object is successfully created from an xml string. However, only the
> setter breakpoint for 'MyString' is hit. Not for 'MyObject'.  This means
> that any logic I require run when calling the setters (such as logging) does
> not occur.
Questions:

a) What does your mapping look like ?
b) What does the input XML document look like ?

> Am I right in assuming that Castor is calling the setter for simple types,
> but uses reflection to set object types? 
Not to my knowledge.

> Is this any way to configure
> Castor not to do this and to always call the setter so my 'setter' logic is
> run? 
Castor should always call the setter on your property (if it is defined
and public), through the corresponding FieldHandler. Unless the property
is defined to be 'direct', where Castor will directly access the field.

I have tried direct="false" on the field element, but to no avail.
Please do not use mapping constructs which you do not fully understand.
A usage of the direct attribute in your context does *not* make sense at
all.
> 
> Advice is appreciated.
> Thanks in advance,
> JB.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to