incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r471709 - /incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java
Date Mon, 06 Nov 2006 12:24:43 GMT
Author: matzew
Date: Mon Nov  6 04:24:42 2006
New Revision: 471709

URL: http://svn.apache.org/viewvc?view=rev&rev=471709
Log:
added Number support in Nov Branch

Modified:
    incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java

Modified: incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java?view=diff&rev=471709&r1=471708&r2=471709
==============================================================================
--- incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java
(original)
+++ incubator/adffaces/branches/stable-06-nov/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/expl/Coercions.java
Mon Nov  6 04:24:42 2006
@@ -84,6 +84,10 @@
       {
         return toDouble(text);
       }
+      else if ((type == Number.class))
+      {
+        return toNumber(text);
+      }
       else if ((type == Character.class) || (type == Character.TYPE))
       {
         Character c = toCharacter(text);
@@ -459,7 +463,19 @@
 
     return null;
   }
+  public static Number toNumber(
+      Object value)
+    {
+      if(((String)value).indexOf(".") == -1){
+        return toInteger(value);
+      }
+      else
+      {
+        return toDouble(value);
+      }
 
+    }
+  
   public static String toString(
     Object value)
   {
@@ -547,4 +563,4 @@
   // We rely strictly on ISO 8601 formats
   private static DateFormat  _ISO_DATE_FORMAT =
     new SimpleDateFormat("yyyy-MM-dd");
-}
+}
\ No newline at end of file



Mime
View raw message