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...?
On Sep 11, 10:13 am, Folke <[EMAIL PROTECTED]> wrote:
> It depends on whether the JSON is hierarchical or flat.
>
> Take a look at the visitor pattern for complexer JSON
> structures.http://en.wikipedia.org/wiki/Visitor_pattern
>
> On 11 Sep., 17:40, Alex Rice <[EMAIL PROTECTED]> wrote:
>
> > Good day all,
>
> > I ordered the GWT in Practice book and eagerly awaiting it's arrival.
> > Maybe maybe my question is answered in there. However, I wanted to see
> > if anyone has a suggestion for a Java OO design pattern to use for the
> > following purpose:
>
> > I am working on a GWT project where application/survey forms are
> > presented to the user. It downloads JSON from our server. The JSON
> > describes the forms layout in terms of sections, fields, labels,
> > formatting, and validation rules for the form the user is filling in.
> > The forms and file attachments will get posted back to the server as
> > JSON and as http file uploads.
>
> > My question is- what is the best Java pattern for constructing the GWT
> > UI on the fly at runtime as the JSON is read from the server? Like a
> > Factory pattern ? Or an Object un-marshalling pattern? I am not that
> > experienced with Java or with Design Patterns, but I have a feeling
> > there is an ideal way to do this, I am just not aware of it.
>
> > Also I am using a MVC pattern to separate the Data and the Views.
> > Thanks in advance for any ideas or pointers on the above.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---