Public: Handle constraints on Primitive fields.
Add TCK test to excercise primitives.
Review at http://gwt-code-reviews.appspot.com/1110801
Review by: rchandia@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9242 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/validation/src/com/google/gwt/sample/validation/shared/Person.java b/samples/validation/src/com/google/gwt/sample/validation/shared/Person.java
index 5bb73db..2e163e2 100644
--- a/samples/validation/src/com/google/gwt/sample/validation/shared/Person.java
+++ b/samples/validation/src/com/google/gwt/sample/validation/shared/Person.java
@@ -17,6 +17,7 @@
import com.google.gwt.user.client.rpc.IsSerializable;
+import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@@ -30,11 +31,23 @@
@Size(min = 4)
private String name;
+ @Max(999999999)
+ private long ssn;
+
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
+
+ }
+
+ public long getSsn() {
+ return ssn;
+ }
+
+ public void setSsn(long ssn) {
+ this.ssn = ssn;
}
}
diff --git a/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java b/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java
index bfb9b4a..6d343f0 100644
--- a/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java
+++ b/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java
@@ -17,6 +17,7 @@
import com.google.gwt.validation.client.GwtValidation;
+import org.hibernate.jsr303.tck.tests.constraints.application.Building;
import org.hibernate.jsr303.tck.tests.constraints.application.SuperWoman;
import org.hibernate.jsr303.tck.tests.constraints.application.Woman;
@@ -26,8 +27,9 @@
* Top Level validator for the TCK tests
*/
@GwtValidation(value = {
- Woman.class,
- SuperWoman.class
+ Building.class,
+ SuperWoman.class,
+ Woman.class
})
public interface TckValidator extends Validator {
}
diff --git a/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java b/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
index 7100a81..e97fec8 100644
--- a/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
+++ b/user/src/com/google/gwt/validation/rebind/GwtSpecificValidatorCreator.java
@@ -24,6 +24,7 @@
import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.dev.jjs.ast.JProgram;
+import com.google.gwt.thirdparty.guava.common.primitives.Primitives;
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
import com.google.gwt.validation.client.impl.AbstractGwtSpecificValidator;
@@ -664,7 +665,7 @@
sw.print("violations, ");
sw.print("null, ");
sw.print("(");
- sw.print(property.getElementClass().getCanonicalName());
+ sw.print(Primitives.wrap(property.getElementClass()).getCanonicalName());
sw.print(") value, ");
sw.println("groups);");