GWT Issue 343 and the JSR-303 Draft (Implementing in GWT)

9 views
Skip to first unread message

chris.ruffalo

unread,
Sep 12, 2008, 3:09:27 PM9/12/08
to Google Web Toolkit Contributors
I've been looking at : http://code.google.com/p/google-web-toolkit/issues/detail?id=343

And I've hit a few snags:

Namely:
Hosted mode works fine but compiling tries to rebind twice (even
though I only have
one GWT.create()) and it can't create the printwriter because the
class it is trying to write
already exists. I guess I need a smarter generator. (?)

How the heck can I reconcile the functionality of java regex and
compiled regex? I
guess I could have a javascriptPattern and javaPattern property on
each validator... but that
sounds like a lot of work for the user. That is unless I've missed a
new development along the
lines of making that easier for developers.

Anyway, any input would be appreciated and I think if I can figure out
these snags and get my
CLA finished (I applied online last night) then I could post the code
and people could start
poking at it a little bit because basic field/method level validation
is working.

Chris Ruffalo


BobV

unread,
Sep 12, 2008, 3:39:43 PM9/12/08
to Google-Web-Tool...@googlegroups.com
> Namely:
> Hosted mode works fine but compiling tries to rebind twice (even
> though I only have
> one GWT.create()) and it can't create the printwriter because the
> class it is trying to write
> already exists. I guess I need a smarter generator. (?)

This is expected behavior. The generator gets called once per
permutation. If the PrintWriter is null, just return the name of the
implementation class that you were tryping to create. It works this
way because you may want to generate different code for different
user.agent values or along some other deferred-binding axis. In this
case, you would name the implementation classes differently.

--
Bob Vawter
Google Web Toolkit Team

chris.ruffalo

unread,
Sep 12, 2008, 11:08:39 PM9/12/08
to Google Web Toolkit Contributors
I see. That worked, I guess I was expecting something bad to happen
if I didn't write new source. In retrospect why would that happen?

Fortunately I don't have to do anything different (per user agent)
yet.

chris.ruffalo

unread,
Sep 17, 2008, 3:38:35 PM9/17/08
to Google Web Toolkit Contributors
One final bit of help.

I'm having problems building a jar that will work with the modules to
compile under a normal project. If I export the jar with Eclipse
everything works fine ("add directory entries" and all that) and the
compile and shell modes work.

If I use an ant task to build the jar then it will not work with the
compiled mode or the shell mode.

I've never been able to have ant (1.7.1) do this in the past either,
on other projects.

Any help would be appreciated.

chris.ruffalo

unread,
Sep 17, 2008, 6:42:04 PM9/17/08
to Google Web Toolkit Contributors
I wasn't including the source files. Disregard. Release should be
soon.

chris.ruffalo

unread,
Sep 17, 2008, 9:07:23 PM9/17/08
to Google Web Toolkit Contributors
Released here : http://code.google.com/p/google-web-toolkit/issues/detail?id=343

Let me know what you think.

chris.ruffalo

unread,
Sep 22, 2008, 10:55:13 AM9/22/08
to Google Web Toolkit Contributors

chris.ruffalo

unread,
Oct 2, 2008, 1:22:33 PM10/2/08
to Google Web Toolkit Contributors
Another release has been made @ http://code.google.com/p/google-web-toolkit/issues/detail?id=343

Please review and send me your comments. I'd like to target this for
the GWT Incubator so I can get some more eyes on and stuff.

My CLA has been electronically submitted and I'm ready to go.

Chris Ruffalo

rb

unread,
Oct 6, 2008, 9:13:20 AM10/6/08
to Google Web Toolkit Contributors
Could this be changed to support Java 5?

The String.isEmpty() and the AbstractValidator.unrollConstraintSet
have Java 6 specific stuff.

A lot more people will be able to use this if you take out the Java 6
stuff.

Thanks,
Rex


On Oct 2, 1:22 pm, "chris.ruffalo" <chris.ruff...@gmail.com> wrote:
> Another release has been made @http://code.google.com/p/google-web-toolkit/issues/detail?id=343
> > Chris Ruffalo- Hide quoted text -
>
> - Show quoted text -

chris.ruffalo

unread,
Oct 6, 2008, 8:23:51 PM10/6/08
to Google Web Toolkit Contributors
Yea, easily. I didn't mean to make it Java6 specific.

isEmpty() seems like a better metaphor, I'll take a loot at it right
now.

Thanks for pointing that out.

rb

unread,
Oct 8, 2008, 9:00:49 AM10/8/08
to Google Web Toolkit Contributors
Is it possible to validate nested objects from a parent?

Thanks,
Rex
> > > - Show quoted text -- Hide quoted text -

chris.ruffalo

unread,
Oct 8, 2008, 12:51:16 PM10/8/08
to Google Web Toolkit Contributors
Yes it is, consider:

public class Parent {

@NotNull
private String parentString = null;

@NotNull
@Valid
private Child child = null;

/*
GETTER AND SETTER METHODS GO HERE
*/
}

public class Child {

@NotEmpty
@NotNull
private String childString = null;

@NotNull
private Parent = null;

/*
GETTER AND SETTER METHODS GO HERE
*/
}

(Not that this example would require proper getter methods and some
set values)

In this case the @Valid annotation causes the validator to Validate
the child class according to the rules of that child class. The
@NotNull validation is performed first howerver /and/ it should be
noted that the @Valid annotation will not be processed on null objects
in any case. The validators also contain logic to prevent cyclic
reprocessing, for example if you set the bidirectional Parent<->Child
relationship as is possible in the example Parent /will not/ be
processed twice and therefore neither will Child. The protection
isn't perfect but it should be enough for the needs of most people.

Let me know if you have any more questions.

chris.ruffalo

unread,
Oct 8, 2008, 12:52:40 PM10/8/08
to Google Web Toolkit Contributors
In the above Example the Parent field should also have an @Valid
annotation.

Also, instead of updating in the GWT issue 343 thread I'm updating
here:

http://code.google.com/p/gwt-validation/

It also has the Java5 release for download.

rb

unread,
Oct 8, 2008, 3:15:53 PM10/8/08
to Google Web Toolkit Contributors
Excellent...thanks!

I was missing the @Valid on the parent.
Reply all
Reply to author
Forward
0 new messages