On Friday, October 19, 2012 3:42:35 PM UTC+2, dhoffer wrote:
>
> I did find that but it doesn't explain much at all. Regarding the
> AutoBeanFactory it just says:
>
> interface MyFactory extends AutoBeanFactory {
> // Factory method for a simple AutoBean
> AutoBean<Person> person();
>
> // Factory method for a non-simple type or to wrap an existing instance
> AutoBean<Person> person(Person toWrap);
> }
>
> There is no explanation of what person() is even in this overly simplified
> case.
>
> Am I to assume that person() refers to getPerson() and
> setPerson(Person) java bean methods on another object?
Not at all. It's a factory method for an AutoBean<Person>, the
implementation will be generated by the call to GWT.create() or
AutoBeanFactorySource.create().
Person itself is an interface with property accessors (getters and
setters). Yet again, the implementation of that interface will be
generated; when you "generate" the AutoBeanFactory that has a method
referencing it (when creating the AutoBeanFactory above, it needs an
implementation of Person, so it'll generate it at the same time as the
implementation of the AutoBeanFactory).
Actually, you don't have to actually call those factory methods, they can
be there only so that the AutoBeanFactory *knows* the interface to be
treated as an AutoBean, so that it'll generate an implementation for it and
you'll be able to deserialize it from JSON.
> If so, does
> AutoBeanFactory require strict java beans naming conventions? In my
> case I don't have Java beans, I just have a serailizable POJO with an
> interface. E.g. getMessages() returns an IGWTMessage. How can I
> configure AutoBeanFactory to handle this?
>
interface MyAutoBeanFactory extends AutoBeanFactory {
AutoBean<IPayload> payload();
}
But in your case that won't work: AutoBeans don't support arrays
(IGWTMessage[]), only lists, sets and maps (e.g. List<IGWTMessage>)
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/JZKJikktXlIJ.
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.