The new AutoBean in 2.1.1 is great. Finally, there is a decent json
tool that works in both js mode and pure JVM mode =)

The basic scenarios described in the wiki (http://code.google.com/p/
google-web-toolkit/wiki/AutoBean#AutoBeanVisitor) work fine for me.
I started poking further and I see some rooms for improvement. If
there are work arounds I missed, please let me know =)

1. arrays / lists of beans
lists as bean properties work fine. However, I couldn't find a way to
operate on a list of beans

say I have

===

interface Bean {...}
interface Factory extends AutoBeanFactory {
    AutoBean<Bean> bean();
}

// create a bean, fill in some properties

// the only serialization code I found is:
String json = AutoBeanCodex.encode(AutoBean wrapper).getPayLoad();

// it would be nice if there is a method that does
AutoBeanCodex.encode( List<AutoBean<?>> warppers ).getPayLoad();

which outputs json arrays of beans:
[ {bean1}, {bean2}, ... ]


One workaround I realized is to have a list interface such as
interface Beans {
    void setBeans(List<Bean>...);
    List<Bean> getBeans();
}
but this introduces quite a bit boiler plate stuff that could be
avoided easily


2. java.util.Date formats

The default date serialization format looks like epoch. Is there a way
to configure this?
This could be a neat feature when using AutoBean in the JSON
interoperability layer. e.g. to work with REST services that only
accept / return ISO8601 full dt formats.
It would be great if such configurations can be set as annotations
e.g.
interface bean {
    @PropertyFormat("yyyy-MM-dd'T'HH:mm:SSZ") // maybe also accept
predefined formats in date time utils?
    Date getDate();
    // or annotate setter
    void setDate(Date date);
}

and the serialized json would be something like
"date":"2011-01-01..."

comments welcome =)



-- 
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-tool...@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.

Reply via email to