It's pretty pointless to pass a raw JSONValue around because it
doesn't have any semantic information. How do you distinguish between
a JSONValue for a "section" and a JSONValue for a "field"?

What you should do is to traverse the JSON data and build an AST or
model objects (--> MVC) and then use two visitors to ...
1. create and attach your view object and later to
2. fetch and write the JSON data that is to be sent back to the
server.

But whatever you do, don't seek perfection. If your code works and
it's clean you may already be as close as you can get.


On Sep 12, 12:16 am, Alex Rice <[EMAIL PROTECTED]> wrote:
> Alas, implementing the standard Visitor pattern on the
> com.google.gwt.json.client.* does not look feasible because I need to
> add the this method  to all the JSON types:
>
>  public void accept(Visitor visitor) {
>         visitor.visit(this);
>     }
>
> However several of the JSON classes dont appear to be subclassable
> because of hiden constructors:
>
> public abstract class JSONValue {
>   /**
>    * Not subclassable outside this package.
>    */
>   JSONValue() {
>   }
>  ...
>
> Not too hard I can come up with a workaround, creating a separate
> "JSONAcceptor" class  but I am wondering why these are not
> subclassable...?

--~--~---------~--~----~------------~-------~--~----~
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