I need to pass key/value pairs via RPC. The value may be any primitive or java.util.Date. I plan to create a Serializable "TransferValue" class that, in turn, contains the actual value. There are 3 approaches I can take, but not sure which would be the most efficient:
1) Declare one java.lang.* wrapper class for each primitive I might want to pass. The not-null one would be the one that's carrying the value: public final class TransferValue extends Object implements Serializable { public String _string; public Date _date; public Boolean _boolean; public Long _long; } 2) Declare one variable for each type of primitive I might want to pass, plus something to indicate which carries the value: public final class TransferValue extends Object implements Serializable { public char _dataType; // s = String, d = Date, b = boolean, and so on... public String _string; public Date _date; public boolean _boolean; public long _long; } 3) Pass all data as java.lang.String, and just use methods on the client and server to encode & decode to the actual type as needed: public final class TransferValue extends Object implements Serializable { public char _dataType; public String _string; } Option 1 is the probably the "cleanest" approach, but is there overhead to have N-1 unused java.lang.* wrapper class fields in every "value" I pass? Option 2 attempts to be more efficient with primitives but is probably worse, since every primitive will bloat my TransferValue object needlessly with their default values? Option 3 is probably the least "clean" since I have to convert things like Dates back and forth into Strings but would appear to be the most efficient. Since it's not so clear, thought I would ask the experts. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.