tags:

views:

160

answers:

1

In GWT 1.7 I have a class used to construct object on the server side which are then used on the client (browser) side.

On the client side I want to cache a service (in this case NumberFormat). This will be initialized lazily in a client-only method, and stored as a field object.

The problem is the Java (1.6) build tools interpret this field as needing to be serialized on the server side (even though it's never accessed on the server).

I could wrap the object in some hander client side but I'd rather specify an annotation to indicate the field will never need serializing for RPC transmission.

public class myCrossDomainObject {

  private int someSerializedField;
  private string anotherSerializedField;

  @SomeAnnotationIKnowNotWhat(..)
  private NumberFormat numberFormatterDontSerializeMe;

  // rest of class ......

}
+3  A: 

Try

private transient NumberFormat numberFormatterDontSerializeMe;
Aaron Digulla
+1 for transient. Static fields are not serialized either.
Bluu