You lost me - if you're using the ComplexObject class on both ends of the
connection and those string constants are final, then why would you ever
want them serialized/sent/deserialized?  They're gonna be the same on both
ends of the connection anyway?

-----Original Message-----
From: Liviu Chiriac [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 2:59 PM
To: [EMAIL PROTECTED]
Subject: RE: how to serialize/deserialize static final fields



Even if they are not 'static' and only 'final' .... it does not work!!

Liviu


-----Original Message-----
From: Zhaohua Meng [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 06, 2003 2:04 PM
To: [EMAIL PROTECTED]
Subject: Re: how to serialize/deserialize static final fields

By definition static variables are not serializable. You need to write 
your own se/deserializer. I am trying to figure out a way to do the same

thing to my application. Once figured out, I will drop some lines here.
Liviu Chiriac wrote:
>  
> 
> Say that I have a Web Service that sends the client a ComplexObject.
The 
> client needs to return it back after setting its name to either 
> ComplexObject.NAME1, ComplexObject.NAME2 or ComplexObject.NAME3
(static 
> final fields - constants)
> 
>  
> 
> The problem is that the static final fields never get 
> serialized/deserialized by the BeanSerializer.
> 
>  
> 
> Is this a bug, or intended behavior? If intended behavior, what is an 
> elegant way of doing it?
> 
>  
> 
> --------------------------------------
> 
> public class ComplexObject implements java.io.Serializable {
> 
>   public static final String NAME1 = "name1";
> 
>   public static final String NAME2 = "name2";
> 
>   public static final String NAME3 = "name3";
> 
>  
> 
>   private name;
> 
>   public void setName(String s) {
> 
>      name = s;
> 
>   }
> 
>   public String getName() {
> 
>      return name;
> 
>   }
> 
> }
> 
> --------------------------------------
> 
>  
> 



Reply via email to