You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/09/20 22:11:57 UTC

svn commit: r448323 - in /beehive/trunk/controls/src: api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java

Author: cschoett
Date: Wed Sep 20 13:11:56 2006
New Revision: 448323

URL: http://svn.apache.org/viewvc?view=rev&rev=448323
Log:
Fix for BEEHIVE-892, changed the default value for AnnotationMemberTypes.Decimal.places from zero to unlimited number of digits following decimal point.

DRTs: controls, passed

Modified:
    beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java

Modified: beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java?view=diff&rev=448323&r1=448322&r2=448323
==============================================================================
--- beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java (original)
+++ beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/AnnotationMemberTypes.java Wed Sep 20 13:11:56 2006
@@ -64,6 +64,7 @@
     public final static short  OPTIONAL_SHORT  = Short.MIN_VALUE;
     public final static char   OPTIONAL_CHAR   = Character.MIN_VALUE;
     public final static byte   OPTIONAL_BYTE   = Byte.MIN_VALUE;
+    public final static int    UNLIMITED_PLACES = -1;
 
     /**
      * Marks a member as optional.  Member must have
@@ -94,7 +95,7 @@
     @Retention(RetentionPolicy.RUNTIME)
     public @interface Decimal
     {
-        int places()      default 0;
+        int places()      default UNLIMITED_PLACES;
         double minValue() default Double.MIN_VALUE;
         double maxValue() default Double.MAX_VALUE;
     }

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java?view=diff&rev=448323&r1=448322&r2=448323
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/bean/AnnotationConstraintValidator.java Wed Sep 20 13:11:56 2006
@@ -515,7 +515,7 @@
 
         int decimalPos = doubleString.indexOf('.');
 
-        if (decimalPos == -1)
+        if (decimalPos == -1 || a.places() == AnnotationMemberTypes.UNLIMITED_PLACES)
             return;
 
         if (doubleString.length() - decimalPos - 1 > a.places())