Inner classes also need a public constructor.

Jim
http://www.gwtorm.com - GWT ORM
http://code.google.com/p/dreamsource-orm/


On Jun 25, 10:49 am, Kwhit <[email protected]> wrote:
> In the following code snippet the inner classes Row and Cell do not
> run through serialization. When it gets to "Verifying instantiability"
> an exception is thrown, see below.
>
> Everything does work if I take the inner classes out and make them
> first class citizens
>
> Code...........
>
> public class DataModel implements Serializable,
> Iterable<DataModel.Row> {
>         private static final long serialVersionUID =
> 5660038413002738627L;
>         public class Row implements Iterable<Cell>, Serializable {
>             private static final long serialVersionUID =
> -8434488660727968577L;
>                 public List<Cell> cells;
>
>                 Row() {
>                         //
>                 }
>
>                 public Cell get(int index) {
>                         Cell result = cells.get(index);
>                         if(result == null) {
>                                 result = new Cell();
>                                 cells.set(index, result);
>                         }
>                         return result;
>                 }
>
>                 public Iterator<Cell> iterator() {
>                       return cells.iterator();
>             }
>         }
>
>         public class Cell implements Serializable {
>             private static final long serialVersionUID =
> -2731510596752061219L;
>                 private String contents;
>
>                 Cell() {
>                         //
>                 }
>
>                 public void setContents(Object contents) {
>                         this.contents = contents == null ? null :
> contents.toString();
>                 }
>
>                 public void setContents(int integer) {
>                         this.contents = Integer.toString(integer);
>                 }
>
>                 public String getContents() {
>                        return contents;
>             }
>         }
>
> Exception.............
>
> Caused by: com.google.gwt.user.client.rpc.SerializationException: Type
> 'com.inexas.flashcards.client.reports.DataModel$Row' was not included
> in the set of types which can be serialized by this
> SerializationPolicy or its Class object could not be loaded. For
> security purposes, this type will not be serialized.
>         at
> com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSer
> ialize
> (StandardSerializationPolicy.java:83)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to