AutoBean objects w/ gwt-validation

112 views
Skip to first unread message

Mena

unread,
Sep 12, 2011, 4:33:40 PM9/12/11
to gwt-validation
Can I use gwt-validation to validate a bean object done by AutoBean.

for example, my Person object has a required field

public interface Person {

@NotNull
public String getFirstName();
public void setFirstName(String firstName);
}

Seems like the annotation is being lost in the process of serializing/
deserializing the Person. Is there a different way that would make
AutoBean work with gwt-validation

chris.r

unread,
Sep 13, 2011, 7:41:45 AM9/13/11
to gwt-validation
I don't know anything about AutoBean but annotations for gwt-
validation are handled at the time the module is compiled. What
happens is the ReflectorFactory has a hashmap of all the classes that
it can provide a reflector for. Chances are that there is a little
too much magic going on here and the implementation's Reflector
implementation cannot be found.

I think I may have a fix for it however. See newly created issue
#44. (http://code.google.com/p/gwt-validation/issues/detail?id=44)

Mena

unread,
Sep 13, 2011, 8:24:13 AM9/13/11
to gwt-validation
"The AutoBean framework provides automatically-generated
implementations of bean-like interfaces and a low-level serialization
mechanism for those interfaces. AutoBeans can be used in both client
and server code to improve code re-use"

In my case, the Person object will have the implementation of the
interface done at run-time and not compile-time .... and AutoBean
maintains the annotation when implementing a bean object. However,
based on your explanation that validation populate the hashmap at
compile time, that makes sense why my object didn't work, since it
didn't exist at compile time.

chris.r

unread,
Sep 13, 2011, 10:30:00 AM9/13/11
to gwt-validation
And, furthermore, it doesn't go find the interfaces properly (read: at
all). So that's what I'm thinking will be the fix for this issue.

Travis Webb

unread,
Jul 8, 2012, 3:29:02 PM7/8/12
to gwt-val...@googlegroups.com
If it counts for anything, I would love to see this feature implemented. Should we create an issue for this?
Reply all
Reply to author
Forward
0 new messages