On Jan 27, 1:51 am, "chris.ruffalo" <[email protected]> wrote: > Hello, list! > > I'm trying to get back into writing my JSR-303 compliant validation > framework for GWT for a couple of reasons. (http://code.google.com/p/ > gwt-validation) > > 1) They (the JSR group) have released an updated/final proposition. > They have also released source code! > 2) I have some free development time and the version 1 isn't something > I'm terribly proud of since I hacked it together for school. > > I'm taking the src-jar from the JSR-303 group, unpacking it, > commenting out the bits that don't work in GWT (java.util.Locale and > java.io.InputStream), and just putting it alongside my code in > Eclipse. I have a feeling that this is not the right way to do it, > nor is it the way I'd like to. I would like to: > > 1) Create an implementation of java.util.Locale and > java.io.InputStream for GWT to use as a reference at compile time. > 2) Reference the src-jar directly by using a "javax.validation" > package with the Validation.gwt.xml in it that references the source > path of "/". > > If I do this, everything should work properly with the added benefit > that I become JSR compliant (to those interfaces) and other people can > use my code alongside whatever validation package they're using with > (hopefully) minimal side effects. > > I've also got another problem... I would really like one code path, so > that the developer using my implementation can call some code like: > > "Validator validator = ValidationFactory.getValidator();" > > Instead of having to use two versions, one for pure java and one for > hosted: > > "Validator validator = new Validator();" > "Validator validator = GWT.create(Validatable.class);" > > I'm planning on generating two things: > > 1) The metadata packages for each class that has validation > annotations. > 2) The runtime-invokers for each of the classes that has validation > annotations. > > Obviously, the reflection code will not work on the GWT side so > something like this will not work because Validator.class has calls to > reflection code: > > public class ValidationFactory { > > public static Validator getValidator() { > > if(GWT.isHosted() || GWT.isScript()) { > return GWT.create(Validatable.class); > } else { > return new Validator(); > } > > } > > }
<super-source/> to the rescue! (for your 2 issues) (have a look at the com.google.gwt.junit.* module for an example, and remember that the code is split into the src/ and super/ directories in SVN) -- 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.
