users@jax-rpc.java.net

Re: static instance of a class

From: Simon Horrell <simonh_at_develop.com>
Date: Mon, 20 May 2002 16:48:15 +0100

In most serialization architectures, the default behaviour is to not
serialize an object's static members. The reason for this is that they are
not part of the object but part of the type. Most serialization
architectures, however, also provide extensibility points where default
serialization behaviour can be changed. This is how the Java (and thus RMI)
and .NET serialization architectures work.

The JAX-RPC specification is not particularly clear but does seem to agree
with this view and although it says that "value types can contain statics"
(5.4) it also says that "by default, only non-static and non-transient
fields are copied" (5.2.3). Of course, just like with Java serialization,
default JAX-RPC serialization behaviour can always be changed by hooking the
extensibility points and using custom serilization techniques. For JAX-RPC
this means implementing and configuring custom [de]serializers.

In general, in the XML world, static does not make much sense. Static is
really an implementation detail, being an OO language feature. In the web
services space we live in a world where we cannot mandate the target runtime
environment.

Si.

----- Original Message -----
From: <yawningrascal_at_HOTMAIL.COM>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Sunday, May 19, 2002 6:49 PM
Subject: static instance of a class


> Hi, what happens if I use something like
>
> public class MyClass
> {
> public static int value;
> public static MyClass BLUE = MyClass(1);
> public static MyClass RED = MyClass(2);
>
> public MyClass()
> {
> }
>
> public MyClass(int value_)
> {
> value = value_
> }
>
> }
>
> ... is it possible for JAX-RPC /SOAP to manage such a class as parameter
> for a remote method so that I can use MyClass.BLUE?
> thanx for advice, Mischa