Ide Roth wrote:
> 
> I have a Java class and I'm trying to convert to XML (marshal) and back to Java 
>object (unmarshal).  The problem I having is the Java object have a getter which 
>return one object and a corresponding setter which take a different object.  I'm 
>allow to make any  change to these functions.
> 
> Example :
> 
>   class A {
> 
>      String attr1 = null;
>      String attr2 = null;
> 
>      public String getAttr1() {
>         return attr1;
>      }
> 
>      public void  setAttr1(String attr) {
>         attr1 = attr;
>      }
> 
>      public String getAttr2() {
>         return attr2;
>      }
> 
>       public void  setAttr2(String attr) {
>         attr2 = attr;
>      }
> 
>      public ResultSet getInfo() {
>          ResultSet result = null;
>         //Some work to retrive the data
>         ...
>         return result;
>      }
> 
>      public void setInfo(Properties resultSet) {
>         attr1 = (String) resultSet.get("ATTR1");
>         attr2 = (String) resultSet.get("ATTR2");
>     }
>  }
> 
>     The marshalling would be fine and an XML would be created.  But when I tried to 
>unmarshal the XML it would failed because the getInfo/setInfo.
> 
>      Is there a way tell the marshal function to ignore the getInfo when I doing the 
>marshalling?
> 

Yes, use a mapping file, define field mappings for all fields you want,
and make sure you do NOT define a field mapping for the "info" field, or
mark the field as transient.


Thanks,

--Keith

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

Reply via email to