Hi Keith,

Here is my example with an interface. (the files are at the bottom of the mail)

"classA" implements "inter" 
"inter"  has this attribute : public static final int OBJECT_STATE_TO_CREATE
"classB" extends "classA"

My mapping file (jejeMappingNine.xml) defines :
* auto-complete="false" for "classA" (by default)
* auto-complete="true" for "classB"

When I marshall an instance of "classB", I get the following error :
org.exolab.castor.mapping.MappingException: Nested error: 
org.exolab.castor.mapping.MappingException: unable to introspect class 'pack9.classB' 
for auto-complete: The field OBJECT_STATE_TO_CREATE in class pack9.inter is not 
accessible -- the field must be public, not static and not transient

Thus, it seems that interface doesn't act as classes, in an auto-complete="true" mode. 
In classes, Castor uses public getter and setter. 
In interfaces, Castor reads directly the attribute and in my case, doesn't like my  
static attribute.
It would be great if, in an interface, Castor try to only marshall the attribute with 
a getter, as it does in classes.

Thank you very much.
See you

--Jerome




-----Message d'origine-----
De : Keith Visco [mailto:[EMAIL PROTECTED]
Envoy� : vendredi 27 f�vrier 2004 20:31
� : [EMAIL PROTECTED]
Objet : Re: [castor-dev] Error in Interface during marshalling




Opps...I didn't notice that you had it set to false...

Please share your example and I can take a look at it.

--Keith

Pastre Jer�me wrote:
> 
> But in my example at the bottom of the email,
> auto-complete is already set to false and i' ve got the error on the field 
> "OBJECT_STATE".
> 
> -----Message d'origine-----
> De : Keith Visco [mailto:[EMAIL PROTECTED]
> Envoy� : jeudi 26 f�vrier 2004 19:00
> � : [EMAIL PROTECTED]
> Objet : Re: [castor-dev] Error in Interface during marshalling
> 
> Hi Jerome,
> 
> Castor will, by default, try to marshal fields from interfaces
> implemented by the class.
> 
> You can prevent this, by not using auto-complete. If you really want to
> use auto-complete, then you can specify the fields that you don't want:
> 
> <class name="classA" auto-complete="true">
>    <field name="OBJECT_STATE" type="integer" transient="true"/>
> </class>
> 
> > Pastre Jer�me wrote:
> >
> > Hi all,
> >
> > Did you have troubles with interface during the marshalling ?
> >
> > Let say classA implements interfaceB
> >
> > public interface interfaceB
> > {
> >         public static final int OBJECT_STATE = 1;
> > }
> >
> > I've mapped "classA" (auto-complete=false) but not "interfaceB".
> > The field mapped for "classA" doesn't refer to "interfaceB".
> >
> > Therefore,  Castor should not go into "interfaceB".
> >
> > But I get that error on "OBJECT_STATE" :
> > > > org.exolab.castor.mapping.MappingException: The field OBJECT_STATE
> > in class
> > > > interfaceB is not accessible -- the field must be public, not
> > static and not
> > > > transient
> >
> > Even if i remove "static", i still have the same error.
> > Notice that i don't want to marshall OBJECT_STATE.
> >
> > What could i do to avoid that ?
> >
> > thanks a lot
> >
> > ______________________________________
> >
> > J�r�me PASTRE
> > Axway. (a Sopra Group company.)
> > R&D Axway Annecy
> > 8       e-mail : [EMAIL PROTECTED]
> > (       phone  : (+33) (0)4 50 33 33 64
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Attachment: inter.java
Description: inter.java

Attachment: classB.java
Description: classB.java

Attachment: classMain.java
Description: classMain.java

Attachment: classA.java
Description: classA.java

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN"
                         "http://castor.exolab.org/mapping.dtd";>

<mapping>

    <class name="pack9.classA">
    </class>            
     
    <class name="pack9.classB"
     		extends="pack9.classA"
    		auto-complete="true">
    </class>            
    
</mapping>



Reply via email to