incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r929900 - /incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java
Date Thu, 01 Apr 2010 09:56:52 GMT
Author: simonetripodi
Date: Thu Apr  1 09:56:51 2010
New Revision: 929900

URL: http://svn.apache.org/viewvc?rev=929900&view=rev
Log:
added generics parameters

Modified:
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java?rev=929900&r1=929899&r2=929900&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java
(original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/routines/StandardValidation.java
Thu Apr  1 09:56:51 2010
@@ -97,7 +97,7 @@ public class StandardValidation implemen
     }
 
     protected <T extends ValidationListener> void validateMinValue(ValidationContext<T>
context) {
-        Comparable minValue = (Comparable) context.getMetaProperty().getFeature(MIN_VALUE);
+        Comparable<Object> minValue = (Comparable<Object>) context.getMetaProperty().getFeature(MIN_VALUE);
         if (minValue == null || context.getPropertyValue() == null) return;
         if (compare(context, minValue, context.getPropertyValue()) > 0) {
             context.getListener().addError(MIN_VALUE, context);
@@ -105,14 +105,14 @@ public class StandardValidation implemen
     }
 
     protected <T extends ValidationListener> void validateMaxValue(ValidationContext<T>
context) {
-        Comparable maxValue = (Comparable) context.getMetaProperty().getFeature(MAX_VALUE);
+        Comparable<Object> maxValue = (Comparable<Object>) context.getMetaProperty().getFeature(MAX_VALUE);
         if (maxValue == null || context.getPropertyValue() == null) return;
         if (compare(context, maxValue, context.getPropertyValue()) < 0) {
             context.getListener().addError(MAX_VALUE, context);
         }
     }
 
-    private <T extends ValidationListener> int compare(ValidationContext<T> context,
Comparable constraintValue,
+    private <T extends ValidationListener> int compare(ValidationContext<T> context,
Comparable<Object> constraintValue,
                         Object currentValue) {
         int r;
         if (constraintValue.getClass().isAssignableFrom(currentValue.getClass())) {
@@ -137,8 +137,8 @@ public class StandardValidation implemen
         int length = 0;
         if (value instanceof String) {
             length = ((String) value).length();
-        } else if (value instanceof Collection) {
-            length = ((Collection) value).size();
+        } else if (value instanceof Collection<?>) {
+            length = ((Collection<?>) value).size();
         }
         if (length > maxLength) {
             context.getListener().addError(MAX_LENGTH, context);
@@ -155,8 +155,8 @@ public class StandardValidation implemen
         int length = 0;
         if (value instanceof String) {
             length = ((String) value).length();
-        } else if (value instanceof Collection) {
-            length = ((Collection) value).size();
+        } else if (value instanceof Collection<?>) {
+            length = ((Collection<?>) value).size();
         }
         if (length < maxLength) {
             context.getListener().addError(MIN_LENGTH, context);



Mime
View raw message